SELECT name,
location_lat,
location_lng,
distance
FROM
(SELECT z.name,
z.location_lat,
z.location_lng,
p.radius,
p.distance_unit * DEGREES(ACOS(COS(RADIANS(p.latpoint)) * COS(RADIANS(z.location_lat)) * COS(RADIANS(p.longpoint - z.location_lng)) + SIN(RADIANS(p.latpoint)) * SIN(RADIANS(z.location_lat)))) AS distance
FROM restaurants AS z
JOIN
(SELECT 29.0907269 AS latpoint,
-111.0281571 AS longpoint,
50.0 AS radius,
111.045 AS distance_unit) AS p ON 1=1
WHERE
z.location_lat BETWEEN p.latpoint - (p.radius / p.distance_unit) AND
p.latpoint + (p.radius / p.distance_unit) AND
z.location_lng BETWEEN p.longpoint - (p.radius / (p.distance_unit * COS(RADIANS(p.latpoint)))) AND p.longpoint + (p.radius / (p.distance_unit * COS(RADIANS(p.latpoint))))) AS d
WHERE distance <= radius
ORDER BY distance LIMIT 15