public function invalidateUnusedTokens(AuthenticationRecordInterface $authenticationRecord)
    {
        $query = $this->getRepository()->createQueryBuilder('r')
            ->update()
            ->set('r.status', UserResetTokenInterface::STATUS_INVALID)
            ->where('r.authentication = :authentication')
            ->andWhere('r.status = :status_unused')
            ->setParameters([
                'authentication' => $authenticationRecord,
                'status_unused' => UserResetTokenInterface::STATUS_UNUSED,
            ])
            ->getQuery();

        $query->execute();
    }