i know... 
it's probably me that mis guided you earlier  but... i think you should use backtick here too :p 
like 
 +        $query .= '`' . $key . '`  = ? AND ';