UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8Cbza1SL3detAVqKp71oVi+YhtL7BV88njxTtz6RZ8w=' 
WHERE 
  key_id = '051ad480343b39599d0325b6e4e214cbf7d80be56d504a90d960f1d615d87d7d' 
  AND (
    token = '8Cbza1SL3detAVqKp71oVi+YhtL7BV88njxTtz6RZ8w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017