UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OSKqaDTT4cWBxC8NL4uilmAYsekhWWOf+2v1zzNiF8s=' 
WHERE 
  key_id = '749308b1ad3a347d233fd86c161a3f29d2542fecb8b8b465879127bd4f4a34fc' 
  AND (
    token = 'OSKqaDTT4cWBxC8NL4uilmAYsekhWWOf+2v1zzNiF8s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035