UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tjg2udrHoOKVthmV+DQf2d7b0cRggNZAoZWtkqO94Vo=' 
WHERE 
  key_id = '3607dd3a2418bdb0757f742625ca1c0b196bdf83312419c6ad6dc7c158d84838' 
  AND (
    token = 'tjg2udrHoOKVthmV+DQf2d7b0cRggNZAoZWtkqO94Vo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032