public function deleteExpired(Token $entity = null)
    {
        $conditions[] = ['expiry <' => new Time];

        if (!empty($entity->token)) {
            $conditions[] = ['token' => $entity->token];
        }

        if (!empty($entity->user_id)) {
            $conditions[] = ['user_id' => $entity->user_id];
        }

        return $this->deleteAll(['OR' => $conditions]);
    }