A few possible approaches for doing this:
- Just put the expiration date in the comment and have a bot remove the line when the expiration date is reached, e.g. \bfoo\.com\b # expiry: 2020-02-25
- Use a similar format as what TitleBlacklist uses, e.g. \bfoo\.com\b <expiry: 2020-02-25>
- Replace the MediaWiki:Spam-blacklist with a special page, Special:SpamBlacklist, that's arranged similarly to Special:Interwiki, with a field for the expiration date, and the data being stored in a database table