Try like this
$meta_query = array('relation' => 'AND');
if($queryGenre)
{
$query_genre = array(
'key' => 'genre',
'value' => $queryGenre,
'compare' => '=',
) ;
array_push($meta_query,$query_genre);
}
if($queryMood)
{
$query_mood = array(
'key' => 'genre''mood',
'value' => $queryMood,
'compare' => '=',
) ;
array_push($meta_query,$query_mood);
}
and at the end do
array_push($args,$meta_query);