I am not sure if you need to use conditions for this. You can change the order of the file to achieve the same. So first declare the 'account' route and then below it declare your route with the variable.
$app->get('/account', function() use () {
echo 'account';
});
$app->get('/:username', function($username) use () {
echo 'user';
})
If it is not possible to change the order of the routes you could use something like this:
$app->get('/:username', function($username) use ($app) {
if($username === 'account') {
$app->redirect('/account');
}
echo 'user';
});
$app->get('/account', function() use () {
echo 'account';
});