diff --git a/session_api.module b/session_api.module
index 8bf4b58..f45de8d 100644
--- a/session_api.module
+++ b/session_api.module
@@ -41,12 +41,16 @@ function session_api_get_sid($create = TRUE) {
   }
 
   if (!isset($sid) || !$sid) {
+    // Initialize the timestamp and sid now for use in conditional checks.
     $sid = FALSE;
-
+    $timestamp = time();
     // First, check if we already have an active session.
     if (isset($_COOKIE['session_api_session']) && $_COOKIE['session_api_session']) {
       $session_id = $_COOKIE['session_api_session'];
-      $sid = db_result(db_query("SELECT sid FROM {session_api} WHERE session_id = '%s'", array(':session_id' => $session_id)));
+      $result = db_query("SELECT sid, timestamp FROM {session_api} WHERE session_id = '%s'", array(':session_id' => $session_id));
+      $session_info = db_fetch_object($result);
+      $sid = $session_info->sid;
+      $timestamp = $session_info->timestamp;
     }
     // If the caller doesn't want to create a new session if it didn't exist, 
     // then return here.
@@ -63,6 +67,10 @@ function session_api_get_sid($create = TRUE) {
     $cookie_domain = ini_get('session.cookie_domain');
     // Update the session timeout.
     if ($sid) {
+      if($timestamp > time() - variable_get('session_api_cookie_update_time', 3600)) {
+        // Skip the update if the timestamp is not old enough (1 hour default).
+        return $sid;
+      }
       $rec = new stdClass;
       $rec->sid = $sid;
 
