Script / keyboard disable should have an optional time out.

If you expect your process to take 20 minutes then disable mouse / keyboard with a 25 minute timeout. That way when an unexpected event pops up and suspends your automated process or the script that did the disable crashes you just need to wait a bit for the mouse / keyboard disable to timeout so that you can recover.

I get around this problem by spawning an "enable" process to run in the background. If you are using AutoIT then all the processes that wait have a timeout that you can use - however it won't help if the script abends.