You cannot directly upgrade a guest user nor upgrade a guest session to have more access rights. Instead you must create a new session for the user.
The simplest approach would be to use the “Sign in” widgets available in your toolbox to create a login page for guest users. After the user clicks on the login button, their page will refresh and they’ll be taken to the home page for their new user role.
If you need some other functionality beyond this, it’s possible but a bit more complicated. Please respond with more details if that’s needed.
Typically you don't need to update the userRoles of an user in a Microflow.
If you create an user in Mendix you will assign him one or more userRoles. This is stored in the database.
When the user visits the application he is an Anonymous user (if you use the custom login page... when you use login.html it won't create the anonymous user and session). When the visitor successfully signs in into Mendix, Mendix will create a new session for the user with the roles assigned to his user (account). No need to assign any roles to the user at that point. Unless you need some dynamic role assignment this should be sufficient.