UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cdzcLIHzBsYT9W/0OcKkTlG2An/uVo7BMlRDXl3+2Dc=' 
WHERE 
  key_id = '8afda1fb41cf5162dd73bfa86e5516a335f1a6f59d942ffdbd3cc40d0e854180' 
  AND (
    token = 'cdzcLIHzBsYT9W/0OcKkTlG2An/uVo7BMlRDXl3+2Dc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037