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 = 2716 
WHERE 
  cscart_products_categories.product_id IN (
    185415, 185391, 185376, 185375, 185380, 
    185377, 185395, 185385, 185416, 185379, 
    185392, 185393, 185386, 185422, 185378, 
    185402, 185388, 185383, 185425, 185382, 
    185400, 185394, 185403, 185387, 185381, 
    185409, 185419, 185397, 185384, 185413, 
    185429, 185424, 185411, 185423, 185421, 
    185404, 185398, 185399, 185407, 185412, 
    185405, 185414, 185418, 185396, 185427, 
    185417, 185428, 185406, 185408, 185431, 
    185389, 185390, 185401, 185426, 185432, 
    185420, 185430, 185410
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00218

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "163.49"
    },
    "grouping_operation": {
      "using_filesort": false,
      "nested_loop": [
        {
          "table": {
            "table_name": "cscart_products_categories",
            "access_type": "range",
            "possible_keys": [
              "PRIMARY",
              "link_type",
              "pt"
            ],
            "key": "pt",
            "used_key_parts": [
              "product_id"
            ],
            "key_length": "3",
            "rows_examined_per_scan": 58,
            "rows_produced_per_join": 58,
            "filtered": "100.00",
            "using_index": true,
            "cost_info": {
              "read_cost": "12.69",
              "eval_cost": "11.60",
              "prefix_cost": "24.29",
              "data_read_per_join": "928"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "link_type"
            ],
            "attached_condition": "(`webmarco`.`cscart_products_categories`.`product_id` in (185415,185391,185376,185375,185380,185377,185395,185385,185416,185379,185392,185393,185386,185422,185378,185402,185388,185383,185425,185382,185400,185394,185403,185387,185381,185409,185419,185397,185384,185413,185429,185424,185411,185423,185421,185404,185398,185399,185407,185412,185405,185414,185418,185396,185427,185417,185428,185406,185408,185431,185389,185390,185401,185426,185432,185420,185430,185410))"
          }
        },
        {
          "table": {
            "table_name": "product_position_source",
            "access_type": "eq_ref",
            "possible_keys": [
              "PRIMARY",
              "pt"
            ],
            "key": "PRIMARY",
            "used_key_parts": [
              "category_id",
              "product_id"
            ],
            "key_length": "6",
            "ref": [
              "const",
              "webmarco.cscart_products_categories.product_id"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 58,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "58.00",
              "eval_cost": "11.60",
              "prefix_cost": "93.89",
              "data_read_per_join": "928"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "position"
            ]
          }
        },
        {
          "table": {
            "table_name": "cscart_categories",
            "access_type": "eq_ref",
            "possible_keys": [
              "PRIMARY",
              "c_status",
              "p_category_id"
            ],
            "key": "PRIMARY",
            "used_key_parts": [
              "category_id"
            ],
            "key_length": "3",
            "ref": [
              "webmarco.cscart_products_categories.category_id"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 2,
            "filtered": "5.00",
            "cost_info": {
              "read_cost": "58.00",
              "eval_cost": "0.58",
              "prefix_cost": "163.49",
              "data_read_per_join": "17K"
            },
            "used_columns": [
              "category_id",
              "usergroup_ids",
              "status",
              "storefront_id"
            ],
            "attached_condition": "((`webmarco`.`cscart_categories`.`storefront_id` in (0,1)) and ((`webmarco`.`cscart_categories`.`usergroup_ids` = '') or find_in_set(0,`webmarco`.`cscart_categories`.`usergroup_ids`) or find_in_set(1,`webmarco`.`cscart_categories`.`usergroup_ids`)) and (`webmarco`.`cscart_categories`.`status` in ('A','H')))"
          }
        }
      ]
    }
  }
}

Result

product_id category_ids position
185375 2716M 0
185376 2716M 0
185377 2716M 0
185378 2716M 0
185379 2716M 0
185380 2716M 0
185381 2716M 0
185382 2716M 0
185383 2716M 0
185384 2716M 0
185385 2716M 0
185386 2716M 0
185387 2716M 0
185388 2716M 0
185389 2716M 0
185390 2716M 0
185391 2716M 0
185392 2716M 0
185393 2716M 0
185394 2716M 0
185395 2716M 0
185396 2716M 0
185397 2716M 0
185398 2716M 0
185399 2716M 0
185400 2716M 0
185401 2716M 0
185402 2716M 0
185403 2716M 0
185404 2716M 0
185405 2716M 0
185406 2716M 0
185407 2716M 0
185408 2716M 0
185409 2716M 0
185410 2716M 0
185411 2716M 0
185412 2716M 0
185413 2716M 0
185414 2716M 0
185415 2716M 0
185416 2716M 0
185417 2716M 0
185418 2716M 0
185419 2716M 0
185420 2716M 0
185421 2716M 0
185422 2716M 0
185423 2716M 0
185424 2716M 0
185425 2716M 0
185426 2716M 0
185427 2716M 0
185428 2716M 0
185429 2716M 0
185430 2716M 0
185431 2716M 0
185432 2716M 0