UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EfYq3lmcRQU95vWTVWJHb80HhTPGiATatB6OkgmKrPE=' 
WHERE 
  key_id = '0e2d456d401a943d3e192982cfd298c980d96aa8f22d194dd27b57ce983e9681' 
  AND (
    token = 'EfYq3lmcRQU95vWTVWJHb80HhTPGiATatB6OkgmKrPE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00060