public function init()
    {
        parent::init();
        $db = $this->getDbConnection();
        $db->setActive(true);
        if ($this->autoCreateTokenTable) {
            $sql = "DELETE FROM {$this->tokenTableName} WHERE (expires>0 AND expires<" . time() . ") OR (uses_allowed>0 AND uses_remaining<1)";
            try {
                $db->createCommand($sql)->execute();
            } catch (Exception $e) {
                $this->createTokenTable($db, $this->tokenTableName);
            }
        }
    }