Made $timeout in BagOStuff::lock() actually work

* Also added a separate $expiry option for things that take a long time

Change-Id: Ie5f81dea031f3c3f3ca8d61ad4cb322a5b876f61
Merge "Made $timeout in BagOStuff::lock() actually work"