Use single transaction to acquire lock