Warn the user if his private key is expiring in X days (whenever he tries to use that key at most X days before the expiration date, or in whatever other way)
(Splitting T2362, which contains two separate issues.)