If you are assigning user roles to customers who buy certain products, you might want to set an expiry date for the user roles. So, after a specific time, the role will be automatically removed from the user (unless they purchase the product again).
To do this, edit your product and click on the ‘Members Only’ tab. In the ‘Expires After’ field, set the duration of the roles in either days, weeks, months or years.