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 = 7156 
WHERE 
  cscart_products_categories.product_id IN (
    94606, 94607, 94608, 94609, 94610, 94611, 
    94612, 94613, 94614, 94615, 94616, 
    94617, 94618, 94654, 94655, 94656, 
    94657, 94658, 94666, 94667, 94668, 
    94669, 94670, 94751, 94752, 94753, 
    94754, 94755, 94756, 94757, 94758, 
    94762, 94764, 95314, 95378, 95379, 
    95380, 95381, 95382, 95383, 95384, 
    95385, 95386, 95387, 95388, 95389, 
    95390, 95391
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.01104

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "70.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": 78,
            "rows_produced_per_join": 78,
            "filtered": "100.00",
            "using_index": true,
            "cost_info": {
              "read_cost": "8.09",
              "eval_cost": "7.80",
              "prefix_cost": "15.89",
              "data_read_per_join": "1K"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "link_type"
            ],
            "attached_condition": "(`nuie_scalesta_net`.`cscart_products_categories`.`product_id` in (94606,94607,94608,94609,94610,94611,94612,94613,94614,94615,94616,94617,94618,94654,94655,94656,94657,94658,94666,94667,94668,94669,94670,94751,94752,94753,94754,94755,94756,94757,94758,94762,94764,95314,95378,95379,95380,95381,95382,95383,95384,95385,95386,95387,95388,95389,95390,95391))"
          }
        },
        {
          "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",
              "nuie_scalesta_net.cscart_products_categories.product_id"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 78,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "19.50",
              "eval_cost": "7.80",
              "prefix_cost": "43.19",
              "data_read_per_join": "1K"
            },
            "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": [
              "nuie_scalesta_net.cscart_products_categories.category_id"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 3,
            "filtered": "5.00",
            "cost_info": {
              "read_cost": "19.50",
              "eval_cost": "0.39",
              "prefix_cost": "70.49",
              "data_read_per_join": "10K"
            },
            "used_columns": [
              "category_id",
              "usergroup_ids",
              "status",
              "storefront_id"
            ],
            "attached_condition": "((`nuie_scalesta_net`.`cscart_categories`.`storefront_id` in (0,1)) and ((`nuie_scalesta_net`.`cscart_categories`.`usergroup_ids` = '') or (0 <> find_in_set(0,`nuie_scalesta_net`.`cscart_categories`.`usergroup_ids`)) or (0 <> find_in_set(1,`nuie_scalesta_net`.`cscart_categories`.`usergroup_ids`))) and (`nuie_scalesta_net`.`cscart_categories`.`status` in ('A','H')))"
          }
        }
      ]
    }
  }
}

Result

product_id category_ids position
94606 7194M
94607 7194M
94608 7194M
94609 7194M
94610 7194M
94611 7194M
94612 7194M
94613 7194M
94614 7194M
94615 7194M
94616 7194M
94617 7194M
94618 7194M
94654 7194M
94655 7194M
94656 7194M
94657 7194M
94658 7194M
94666 7194M
94667 7194M
94668 7194M
94669 7194M
94670 7194M
94751 7157M,7343,7341,7342
94752 7343,7341,7342,7157M
94753 7342,7157M,7343,7341
94754 7342,7343,7341,7157M
94755 7341,7343,7157M,7342
94756 7342,7341,7157M,7343
94757 7342,7157M,7343,7341
94758 7342,7341,7343,7157M
94762 7157M,7342,7341,7343
94764 7342,7343,7157M,7341
95314 7194M
95378 7194M
95379 7194M
95380 7194M
95381 7194M
95382 7194M
95383 7194M
95384 7194M
95385 7194M
95386 7194M
95387 7194M
95388 7194M
95389 7194M
95390 7194M
95391 7194M