UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Qx2v94mLymFqToB4l4+vt57j+B6b2jXamlXGTbRAXwo=' 
WHERE 
  key_id = '846fc7f605bff33a387c710bcd5fe77c2ef2deee85c631bca930dcc436193eb8' 
  AND (
    token = 'Qx2v94mLymFqToB4l4+vt57j+B6b2jXamlXGTbRAXwo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020