UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'n0OS5IfsSQkwE33JmvP2upaLaweEaFoe3wTzmpkIUBQ=' 
WHERE 
  key_id = '00fe7d5a2530afe6f0563d9f0916b49bd5300d1e39f4a55df82ceb7b481c8a71' 
  AND (
    token = 'n0OS5IfsSQkwE33JmvP2upaLaweEaFoe3wTzmpkIUBQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050