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 = 7143 
WHERE 
  cscart_products_categories.product_id IN (
    98282, 98283, 98284, 98285, 98286, 98287, 
    98288, 98289, 98290, 98291, 98292, 
    98293, 98294, 98295, 98296, 98297, 
    98298, 98299, 98300, 98301, 98302, 
    98303, 98304, 98305, 98306, 98307, 
    98308, 98309, 98310, 98311, 98312, 
    98313, 98314, 98315, 98316, 98317, 
    98318, 98319, 98320, 98321, 98482, 
    98572, 98573, 98574, 98575, 98576, 
    98577, 98578, 98579, 98580, 98581, 
    98582, 98583, 98584, 98585, 98586, 
    98687, 98688, 98689, 98690, 98691, 
    98692, 98693, 98694, 98695, 98696, 
    98697, 98698, 98699, 98700, 98701, 
    98702, 98703, 98704, 98705, 98706, 
    98707, 98708, 98709, 98710, 98711, 
    98712, 98713, 98714, 98715, 98738, 
    98739, 98740, 98741, 98742, 98743, 
    98744, 98745, 98746, 98747, 98748
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.01644

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "112.80"
    },
    "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": 125,
            "rows_produced_per_join": 125,
            "filtered": "100.00",
            "using_index": true,
            "cost_info": {
              "read_cost": "12.81",
              "eval_cost": "12.50",
              "prefix_cost": "25.31",
              "data_read_per_join": "1K"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "link_type"
            ],
            "attached_condition": "(`nuie_scalesta_net`.`cscart_products_categories`.`product_id` in (98282,98283,98284,98285,98286,98287,98288,98289,98290,98291,98292,98293,98294,98295,98296,98297,98298,98299,98300,98301,98302,98303,98304,98305,98306,98307,98308,98309,98310,98311,98312,98313,98314,98315,98316,98317,98318,98319,98320,98321,98482,98572,98573,98574,98575,98576,98577,98578,98579,98580,98581,98582,98583,98584,98585,98586,98687,98688,98689,98690,98691,98692,98693,98694,98695,98696,98697,98698,98699,98700,98701,98702,98703,98704,98705,98706,98707,98708,98709,98710,98711,98712,98713,98714,98715,98738,98739,98740,98741,98742,98743,98744,98745,98746,98747,98748))"
          }
        },
        {
          "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": 125,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "31.25",
              "eval_cost": "12.50",
              "prefix_cost": "69.06",
              "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": 6,
            "filtered": "5.00",
            "cost_info": {
              "read_cost": "31.25",
              "eval_cost": "0.63",
              "prefix_cost": "112.81",
              "data_read_per_join": "16K"
            },
            "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
98282 7302M
98283 7302M
98284 7302M
98285 7302M
98286 7302M
98287 7302M
98288 7302M
98289 7302M
98290 7161M,7303
98291 7161M,7303
98292 7161M,7303
98293 7161M,7303
98294 7161M,7303
98295 7161M,7303
98296 7161M,7303
98297 7161M,7303
98298 7161M,7303
98299 7161M,7303
98300 7161M,7303
98301 7161M,7303
98302 7161M,7303
98303 7161M,7303
98304 7161M,7303
98305 7161M,7303
98306 7161M,7303
98307 7161M,7303
98308 7161M,7303
98309 7161M,7303
98310 7161M,7303
98311 7161M,7303
98312 7161M,7303
98313 7161M,7303
98314 7304M
98315 7304M
98316 7304M
98317 7304M
98318 7304M
98319 7304M
98320 7304M
98321 7304M
98482 7149M,7182,7300
98572 7302M
98573 7302M
98574 7302M
98575 7302M
98576 7302M
98577 7302M
98578 7302M
98579 7302M
98580 7302M
98581 7302M
98582 7302M
98583 7302M
98584 7302M
98585 7302M
98586 7302M
98687 7145M
98688 7146M
98689 7145M
98690 7151M,7301
98691 7146M
98692 7146M
98693 7151M,7301
98694 7151M,7301
98695 7326M
98696 7326M
98697 7146M
98698 7145M
98699 7145M
98700 7147M
98701 7189M
98702 7326M
98703 7326M
98704 7326M
98705 7326M
98706 7326M
98707 7326M
98708 7326M
98709 7326M
98710 7326M
98711 7326M
98712 7326M
98713 7326M
98714 7326M
98715 7326M
98738 7147M
98739 7145M
98740 7146M
98741 7145M
98742 7147M
98743 7145M
98744 7146M
98745 7145M
98746 7147M
98747 7145M
98748 7146M