public static function expire()
    {
        // #####################
        // Delete expired entries
        // #####################

        $query = 'DELETE FROM tx_metaseo_sitemap
                        WHERE is_blacklisted = 0
                          AND expire <= ' . (int)time();
        DatabaseUtility::exec($query);

        // #####################
        //  Deleted or
        // excluded pages
        // #####################
        $query = 'SELECT ts.uid
                    FROM tx_metaseo_sitemap ts
                         LEFT JOIN pages p
                            ON p.uid = ts.page_uid
                           AND p.deleted = 0
                           AND p.hidden = 0
                           AND p.tx_metaseo_is_exclude = 0
                           AND ' . DatabaseUtility::conditionNotIn('p.doktype', self::getDoktypeBlacklist()) . '
                   WHERE p.uid IS NULL';

        $deletedSitemapPages = DatabaseUtility::getColWithIndex($query);

        // delete pages
        if (!empty($deletedSitemapPages)) {
            $query = 'DELETE FROM tx_metaseo_sitemap
                            WHERE uid IN (' . implode(',', $deletedSitemapPages) . ')
                              AND is_blacklisted = 0';
            DatabaseUtility::exec($query);
        }
    }