Issue #2379883 by Alan Evans, Jeremy: fix broken logic and order of precedence error in lock_acquire so lock renewal works correctly