add timeout param to Lock

Instead of blocking forever on a lock, optionally specify a timeout and raise a LockTimeout exception if we don't acquire the lock within that time.