private function matchingLock($lockID, array $next, Connection $db)
    {
        // Then go back and double check that we successfully locked it
        $qb = $db->createQueryBuilder();

        $select = $qb
            ->select('*')
            ->from($this->table, 't')
            // Match the lock ID we just tried to set
            ->where($qb->expr()->eq($this->lockColumn, $qb->expr()->literal($lockID)));

        // Build additional predicates from already known values
        $predicates = array_map(function ($value, $key) use ($qb) {
            return $qb->expr()->eq($key, $qb->expr()->literal($value));
        }, $next, array_keys($next));

        call_user_func_array([$select, 'andWhere'], $predicates);

        // Get the result and validate it
        if ($result = $select->setMaxResults(1)->execute()->fetch()) {
            return $result;
        }

        return false;
    }