UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gN8B3OwZZADAqs2AC5gP7l5ig/TJRfTO0a6m62gHVd0=' 
WHERE 
  key_id = 'ab4af80cf2e5dc936806ff04e02e281f7f016340f8f2e8b38cc27f8d73ac5146' 
  AND (
    token = 'gN8B3OwZZADAqs2AC5gP7l5ig/TJRfTO0a6m62gHVd0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016