diff --git a/core/lib/Drupal/Core/Lock/DatabaseLockBackend.php b/core/lib/Drupal/Core/Lock/DatabaseLockBackend.php
index d877dba..84c616f 100644
--- a/core/lib/Drupal/Core/Lock/DatabaseLockBackend.php
+++ b/core/lib/Drupal/Core/Lock/DatabaseLockBackend.php
@@ -74,6 +74,11 @@ public function acquire($name, $timeout = 30.0) {
   public function lockMayBeAvailable($name) {
     $lock = db_query('SELECT expire, value FROM {semaphore} WHERE name = :name', array(':name' => $name))->fetchAssoc();
     if (!$lock) {
+      // Missing the lock? Ensure it is not cached.
+      if (isset($this->locks[$name])) {
+        // Oh noes! A broken lock. Delete the cache.
+        unset($this->locks[$name]);
+      }
       return TRUE;
     }
     $expire = (float) $lock['expire'];
@@ -82,11 +87,18 @@ public function lockMayBeAvailable($name) {
       // We check two conditions to prevent a race condition where another
       // request acquired the lock and set a new expire time. We add a small
       // number to $expire to avoid errors with float to string conversion.
-      return (bool) db_delete('semaphore')
+      $result = (bool) db_delete('semaphore')
         ->condition('name', $name)
         ->condition('value', $lock['value'])
         ->condition('expire', 0.0001 + $expire, '<=')
         ->execute();
+      // If it is successfully deleted and still in the cache.
+      if ($result && isset($this->locks[$name])) {
+        // Then delete it from the cache.
+        unset($this->locks[$name]);
+      }
+      // If it was deleted then it will be available.
+      return $result;
     }
     return FALSE;
   }
