[LockManager] Added timeout to the lock() function.