That is probably straight forward with a simple script. Just have a cron-triggered script (php for example) check the discussions table in the database for "last_post_at" datetime to be older than XX. Then update the "is_locked" field to be 1.
I am doing this for a few things such as creating random default avatars for users who just registered and did not upload a custom avatar. It randomly grabs an avatar from a folder and uses that. Works great.