[ticket/11495] Add owns_lock() method to lock classes

PHPBB3-11495
[ticket/11495] Use $lock->owns_lock() instead of own property

PHPBB3-11495