diff --git includes/lock.inc includes/lock.inc
index 546f6bf..f69123e 100644
--- includes/lock.inc
+++ includes/lock.inc
@@ -109,8 +109,11 @@ function lock_acquire($name, $timeout = 30.0) {
       ->condition('value', _lock_id())
       ->execute();
     if (!$success) {
-      // The lock was broken.
-      unset($locks[$name]);
+      // The update did not change any row. Is there a row with the same $expire?
+      if (! db_query('SELECT expire FROM semaphore WHERE name = :name AND value = :value', array(':name' => $name, ':value' => _lock_id()))->rowCount()) {
+        // There is no identical row in the table. The lock was broken.
+        unset($locks[$name]);
+      }
     }
     return $success;
   }
