Split the key that you give them into two parts using /12 for the key and %12 for the month it is issued. Subtract the modulo part in months from the current date to offset the month and then apply your existing formula. So instead of pwd = key * now.year()
it will be something like:
pwd = int(key /12) * date(now - months(key % 12)).year()