UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rrbw6thk3xZ1tZmoff6f4WF02/02Qf9xo0YYFsnz9Xo=' 
WHERE 
  key_id = '348b84e47bff485883a842706aa01c33cd6a31f6817d528573accaba5dd41c34' 
  AND (
    token = 'rrbw6thk3xZ1tZmoff6f4WF02/02Qf9xo0YYFsnz9Xo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024