Update generate_token to set order column