Simplified the timed try lock implementation.