Man liekas, ka iesakot subquery, domāja ko šādu
select sub.*
from (select u.id,
st_distance_sphere(
ST_SetSrid(ST_MakePoint(u.longitude::numeric, u.latitude::numeric), 4326),
ST_SetSrid(ST_MakePoint(60.02402367490043, 30.437835716692238), 4326))
as closeness
from users u
where u.is_online = true and and u.longitude is not null and u.latitude is not null
) as sub
where 10000 < sub.closeness
order by sub.closeness
limit 10