transaction: rename lock() to lock_ref()

This leaves space for future expansion to locking other resources
without having to change the API for references.