public function extend_lock(lock $lock, $maxlifetime = 86400) {
        $now = time();
        $expires = $now + $maxlifetime;
        $params = array('expires' => $expires,
                        'token' => $lock->get_key());

        $sql = 'UPDATE {lock_db}
                    SET
                        expires = :expires,
                    WHERE
                        owner = :token';

        $this->db->execute($sql, $params);
        $countparams = array('owner' => $lock->get_key());
        $result = $this->count_records('lock_db', $countparams);

        return $result === 0;
    }