UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+oANEFoknciWPThtqAWAiHZITgzOuaPx8DfNyBbBY5M=' 
WHERE 
  key_id = '1272f29396eb46e92c193ac523e43d49ba48aa84f1456f8060be6d897a9b16eb' 
  AND (
    token = '+oANEFoknciWPThtqAWAiHZITgzOuaPx8DfNyBbBY5M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032