UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'y8G4ggU4ynMoxlsXLvvSPxWPmqHMDda/XdLgt/o9N1Q=' 
WHERE 
  key_id = '131e6376f592b91fa856ba628ce9235e606094a40dc39cd52b1643167c7be40f' 
  AND (
    token = 'y8G4ggU4ynMoxlsXLvvSPxWPmqHMDda/XdLgt/o9N1Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00077