db_select with mysql reserved word in the statement
You can use where() instead:

$query = db_select('my_table', 'd')
  -&gt;fields('d', array('sort_id', '`when`', 'user'))
  -&gt;condition('user', '123')
  -&gt;where('`when` = :timestamp', array(':timestamp' =&gt; 1448160590))
  -&gt;execute();


Produces:

SELECT d.sort_id AS sort_id, d.when AS when, d.user AS user
FROM 
{my_table} d
WHERE  (user = :db_condition_placeholder_0) AND (`when` = :timestamp)