How to make a lock forget?
Is there some way to make the lock expire after a while?


lock_acquire takes a second parameter, defining the lifetime of the lock:

https://api.drupal.org/api/drupal/includes%21lock.inc/function/lock_acquire/7.x

The Drupal 8 version would be:

lock-&gt;acquire($name, $timeout);

https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Lock%21DatabaseLockBackend.php/function/DatabaseLockBackend%3A%3Aacquire/8.2.x