How to get data from MySQL table based on a junction table
You can do something like this:
SELECT a.*
   ,st_distance_sphere(POINT(68.8543843, 27.6677608 ), POINT(a.`longitude`, a.`latitude` ))/1000   as distance
FROM `activities` a INNER JOIN `activity_interests` ai ON a.id = ai.activity_id 
WHERE is_public = true
   AND (
             DATEDIFF(end_time, start_time) &gt; 0
         OR
             TIME_TO_SEC(TIMEDIFF(TIME(end_time), TIME(start_time))) &gt; 10
     ) 
     AND ai.interest_id IN (1,2,3)
HAVING distance &lt;= 22

As long as you don't provide data, I can only hint at how it would look like.
SELECT a.*,st_distance_sphere(POINT(68.8543843, 27.6677608 ), POINT(`longitude`, `latitude` ))/1000   as distance
FROM `activities` a INNER JOIN `activity_interests` ai ON a.id = ai.activity_id 
WHERE is_public = true
   AND (
             DATEDIFF(end_time, start_time) &gt; 0
         OR
             TIME_TO_SEC(TIMEDIFF(TIME(end_time), TIME(start_time))) &gt; 10
     ) 
     AND SUM(ai.interest_id =1) + SUM(ai.interest_id =2) + SUM(ai.interest_id =3) = 3
GROUP BY a.id,distance
HAVING distance &lt;= 22