Should be relatively easy then. You could do it with separate products, or just change the price of a single product. Either way you would store the timestamp of the purchase and then add a column to the cart to store the duration of the membership.
For ease I would probably just do it as separate products.
You would then be able to update your SQL statement you are currently using to give access to the course so that it accounts for the time of the purchase and the duration so that it is only available for that limited time.