Replaces .lock/.unlock with lock_guard

The locking of the locks_table was previously using calls to .lock() and
.unlock() with a std::lock_guard