UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'otZ0nRo7kjDLTI0a9TPHuYBydRAXpU8/VltiHDVSlZM=' 
WHERE 
  key_id = 'b57163b8732d6d5147470046d53136920a51d53e5cd02dd95249ff9d42d5d288' 
  AND (
    token = 'otZ0nRo7kjDLTI0a9TPHuYBydRAXpU8/VltiHDVSlZM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032