How to check if an item exists in a Queue?
The queue API doesn't have a method for this. It is very limited on purpose, as some queue systems might not be able to provide information like this.

The update module has its own wrapper to do this, by additionally storing all the task names in key value as well. See \Drupal\update\UpdateProcessor::createFetchTask:

public function createFetchTask($project) {
  if (empty($this-&gt;fetchTasks)) {
    $this-&gt;fetchTasks = $this-&gt;fetchTaskStore-&gt;getAll();
  }
  if (empty($this-&gt;fetchTasks[$project['name']])) {
    $this-&gt;fetchQueue-&gt;createItem($project);
    $this-&gt;fetchTaskStore-&gt;set($project['name'], $project);
    $this-&gt;fetchTasks[$project['name']] = REQUEST_TIME;
  }
}