Index not used with many WHERE LOWER(column) IN (...) conditions, works fine with just a few
Don't do that. Use citext

CREATE EXTENSION citext;
CREATE TABLE public.devices
(
  id integer NOT NULL DEFAULT nextval('devices_id_seq'::regclass),
  token citext NOT NULL,
  ...some other columns...,
  CONSTRAINT devices_pkey PRIMARY KEY (id, token)
)
CREATE INDEX IF NOT EXISTS idx_devices_lower_token ON devices(token);


Then

AND token IN ('92134f4bb6a2263fd044a5a04440bc1a','cbf7d4a094bd266fd3f1b7ef4196172a', 'aa0f7650cf28010b5c01b77ae206f7fb', ... up to 1k tokens ...))) 


And if you're talking about a thousand tokens you should probably use a temp table..

CREATE TEMP TABLE query_params ( token citext );
INSERT INTO query_params(token) VALUES ...


then

SELECT * 
FROM devices
WHERE (id &gt; '0') 
AND EXISTS (
  SELECT 1
  FROM query_params
  WHERE query_params.token = devices.token
)
ORDER BY id 
LIMIT 1000;


You can even index query_params.token