SELECT 
  cscart_products_categories.product_id, 
  GROUP_CONCAT(
    IF(
      cscart_products_categories.link_type = "M", 
      CONCAT(
        cscart_products_categories.category_id, 
        "M"
      ), 
      cscart_products_categories.category_id
    )
  ) AS category_ids, 
  product_position_source.position AS position 
FROM 
  cscart_products_categories 
  INNER JOIN cscart_categories ON cscart_categories.category_id = cscart_products_categories.category_id 
  AND cscart_categories.storefront_id IN (0, 1) 
  AND (
    cscart_categories.usergroup_ids = '' 
    OR FIND_IN_SET(
      0, cscart_categories.usergroup_ids
    ) 
    OR FIND_IN_SET(
      1, cscart_categories.usergroup_ids
    )
  ) 
  AND cscart_categories.status IN ('A', 'H') 
  LEFT JOIN cscart_products_categories AS product_position_source ON cscart_products_categories.product_id = product_position_source.product_id 
  AND product_position_source.category_id = 166 
WHERE 
  cscart_products_categories.product_id IN (
    17, 180, 18, 16, 4, 5, 23, 24, 1, 22, 149, 
    190, 189, 3438, 3439, 3440, 3441, 136148, 
    156245, 169350, 125861, 122330, 133778, 
    146242, 143574, 121541, 130403, 120464, 
    125358, 154235, 137235, 157361, 133193, 
    166388, 176206, 128666, 158252, 135956, 
    162915, 132858, 144027, 124934, 132112, 
    135084, 158535, 147929, 173481, 137775, 
    151549, 162201, 162374, 121316, 166649, 
    167453, 161383, 172324, 140024, 156616, 
    169021, 155568, 138561, 121611, 140621, 
    147362
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00275

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost": 0.327857853,
    "nested_loop": [
      {
        "table": {
          "table_name": "cscart_products_categories",
          "access_type": "range",
          "possible_keys": ["PRIMARY", "pt"],
          "key": "pt",
          "key_length": "3",
          "used_key_parts": ["product_id"],
          "loops": 1,
          "rows": 65,
          "cost": 0.115664525,
          "filtered": 100,
          "attached_condition": "cscart_products_categories.product_id in (17,180,18,16,4,5,23,24,1,22,149,190,189,3438,3439,3440,3441,136148,156245,169350,125861,122330,133778,146242,143574,121541,130403,120464,125358,154235,137235,157361,133193,166388,176206,128666,158252,135956,162915,132858,144027,124934,132112,135084,158535,147929,173481,137775,151549,162201,162374,121316,166649,167453,161383,172324,140024,156616,169021,155568,138561,121611,140621,147362)",
          "using_index": true
        }
      },
      {
        "table": {
          "table_name": "cscart_categories",
          "access_type": "eq_ref",
          "possible_keys": ["PRIMARY", "c_status", "p_category_id"],
          "key": "PRIMARY",
          "key_length": "3",
          "used_key_parts": ["category_id"],
          "ref": [
            "u985510652_ecartify_abhi.cscart_products_categories.category_id"
          ],
          "loops": 65,
          "rows": 1,
          "cost": 0.0589578,
          "filtered": 100,
          "attached_condition": "cscart_categories.storefront_id in (0,1) and (cscart_categories.usergroup_ids = '' or find_in_set(0,cscart_categories.usergroup_ids) or find_in_set(1,cscart_categories.usergroup_ids)) and cscart_categories.`status` in ('A','H')"
        }
      },
      {
        "table": {
          "table_name": "product_position_source",
          "access_type": "eq_ref",
          "possible_keys": ["PRIMARY", "pt"],
          "key": "PRIMARY",
          "key_length": "6",
          "used_key_parts": ["category_id", "product_id"],
          "ref": [
            "const",
            "u985510652_ecartify_abhi.cscart_products_categories.product_id"
          ],
          "loops": 65,
          "rows": 1,
          "cost": 0.1113866,
          "filtered": 100
        }
      }
    ]
  }
}

Result

product_id category_ids position
1 190M
4 190M
5 191M
16 194M
17 307,235M
18 194M
22 195M
23 195M
24 195M
149 179M
180 200M
189 200M
190 200M
3438 166M 0
3439 166M 0
3440 166M 0
3441 166M 0
120464 304M
121316 309M
121541 310M
121611 310M
122330 304M
124934 304M
125358 310M
125861 310M
128666 310M
130403 304M
132112 309M
132858 309M
133193 309M
133778 304M
135084 310M
135956 304M
136148 310M
137235 304M
137775 310M
138561 310M
140024 310M
140621 310M
143574 309M
144027 310M
146242 304M
147362 304M
147929 310M
151549 304M
154235 309M
155568 309M
156245 310M
156616 309M
157361 309M
158252 304M
158535 304M
161383 309M
162201 310M
162374 310M
162915 304M
166388 310M
166649 309M
167453 304M
169021 309M
169350 310M
172324 304M
173481 304M
176206 310M