UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '37knrb7XP+mBqVoJEnGqWmVGz9yyQaViPGFZV/THNe0=' 
WHERE 
  key_id = '52d9b4b12d1fe47657dc07e1db3f93420e2a876f89e41b08232033ecf4d4839f' 
  AND (
    token = '37knrb7XP+mBqVoJEnGqWmVGz9yyQaViPGFZV/THNe0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041