Those seem like somewhat inelegant solutions. If I were to design something like this, I’d run it as a batch process. If you’re talking about a 6-month gap, precision to the level of days should be fine. Just scan your db nightly or even weekly and lock the old ones. It still consumes CPU and all, but on a schedule instead of all the time.