UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NEre6mnWZJUi2KBRiWXjksowHYSJwGV6d0kxpZ6ddSE=' 
WHERE 
  key_id = '5b17d6ec116023a9c8324a994ec2c5fe305f5b18998b0668075f14b382069355' 
  AND (
    token = 'NEre6mnWZJUi2KBRiWXjksowHYSJwGV6d0kxpZ6ddSE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035