Show the *actual* query.
Probably your tablename or column is/are keyword(s).
will give that error, because key is a reserved keyword.
SELECT * FROM anytable WHERE key = 'whatever'
If indeed that's the problem, you can either change the column (or table) name or you can put backticks ( the ` character...usually shares a key with the ~ character) around the problem name(s). Which seems to be what you did, so I'm not clear why you think there is another problem.
But if that's not the problem, you'll have to show your real code. It doesn't work to show us sample code that wouldn't have the problem.
SELECT * FROM anytable WHERE `key` = 'whatever'
Oh...one more thing: If the field in question is *NOT* a text field (e.g., a CHAR() or VARCHAR() field) or datetime field, then technically you should *not* put apostrophes around the value you are testing.
You normally only use apostrophes around text and date/time values.
SELECT * FROM anytable WHERE `key` = 17
SELECT * FROM anytable WHERE `key` = 17.3718
MySQL (almost alone among databases) usually *will* allow you to put apostrophes around numeric values, but it's not a good practice to get into. For some reason, many PHP programmers put them there, unlike programmers in other server side languages.