diff --git a/scp/logout.php b/scp/logout.php
index 0a7f6ee8e9f5c3c259e45e0b8bf515e69e08c515..02e7775aa868142123272d6df414a03f9a0a9f1f 100644
--- a/scp/logout.php
+++ b/scp/logout.php
@@ -20,18 +20,23 @@ require('staff.inc.php');
 if(!$_GET['auth'] || !$ost->validateLinkToken($_GET['auth']))
     @header('Location: index.php');
 
-$thisstaff->logOut();
-
-//Clear any ticket locks the staff has.
-Lock::removeStaffLocks($thisstaff->getId());
-
-//Destroy session on logout.
-// TODO: Stop doing this starting with 1.9 - separate session data per
-// app/panel.
-session_unset();
-session_destroy();
-
-osTicketSession::destroyCookie();
+try {
+    $thisstaff->logOut();
+
+    //Destroy session on logout.
+    // TODO: Stop doing this starting with 1.9 - separate session data per
+    // app/panel.
+    session_unset();
+    session_destroy();
+
+    osTicketSession::destroyCookie();
+
+    //Clear any ticket locks the staff has.
+    Lock::removeStaffLocks($thisstaff->getId());
+}
+catch (Exception $x) {
+    // Lock::removeStaffLocks may throw InconsistentModel on upgrade
+}
 
 @header('Location: login.php');
 require('login.php');