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 = 7170 
WHERE 
  cscart_products_categories.product_id IN (
    83049, 90885, 90964, 83070, 83623, 89816, 
    89868, 89940, 90906, 90985, 91506, 
    85848, 85849, 85858, 85859, 83081, 
    83609, 85081, 85167, 85213, 85259, 
    86142, 86165, 86658, 86727, 90920, 
    90999, 85854, 85855, 85864, 85865, 
    89997, 90004, 84535, 84601, 85121, 
    89077, 83074, 83075, 83627, 83628, 
    84657, 84658, 86627, 86696, 90910, 
    90911, 90989, 90990, 85084, 85085, 
    85170, 85171, 85216, 85217, 85262, 
    85263, 85314, 85411, 85462, 85513, 
    85317, 85318, 85414, 85415, 85465, 
    85466, 85516, 85517, 86471, 86472, 
    86747, 86748, 85838, 85839, 82852, 
    82853, 82925, 82926, 82998, 82999, 
    83514, 83515, 83522, 83523, 85844, 
    85845, 86192, 86215, 86524, 86800, 
    85124, 85125, 85363, 85364, 89075
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00288

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "91.69"
    },
    "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": 161,
            "rows_produced_per_join": 161,
            "filtered": "100.00",
            "using_index": true,
            "cost_info": {
              "read_cost": "16.42",
              "eval_cost": "16.10",
              "prefix_cost": "32.52",
              "data_read_per_join": "2K"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "link_type"
            ],
            "attached_condition": "(`nuie_scalesta_net`.`cscart_products_categories`.`product_id` in (83049,90885,90964,83070,83623,89816,89868,89940,90906,90985,91506,85848,85849,85858,85859,83081,83609,85081,85167,85213,85259,86142,86165,86658,86727,90920,90999,85854,85855,85864,85865,89997,90004,84535,84601,85121,89077,83074,83075,83627,83628,84657,84658,86627,86696,90910,90911,90989,90990,85084,85085,85170,85171,85216,85217,85262,85263,85314,85411,85462,85513,85317,85318,85414,85415,85465,85466,85516,85517,86471,86472,86747,86748,85838,85839,82852,82853,82925,82926,82998,82999,83514,83515,83522,83523,85844,85845,86192,86215,86524,86800,85124,85125,85363,85364,89075))"
          }
        },
        {
          "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": 8,
            "filtered": "5.00",
            "cost_info": {
              "read_cost": "40.25",
              "eval_cost": "0.81",
              "prefix_cost": "88.87",
              "data_read_per_join": "21K"
            },
            "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')))"
          }
        },
        {
          "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": 8,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "2.01",
              "eval_cost": "0.81",
              "prefix_cost": "91.69",
              "data_read_per_join": "128"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "position"
            ]
          }
        }
      ]
    }
  }
}

Result

product_id category_ids position
82852 7170,7171M 0
82853 7170,7171M 0
82925 7170,7171M 0
82926 7170,7171M 0
82998 7170,7171M 0
82999 7170,7171M 0
83049 7192M
83070 7170,7171M 0
83074 7192M
83075 7192M
83081 7170,7191M 0
83514 7170,7171M 0
83515 7170,7171M 0
83522 7170,7171M 0
83523 7170,7171M 0
83609 7170,7191M 0
83623 7170,7171M 0
83627 7192M
83628 7192M
84535 7170,7200M 0
84601 7170,7200M 0
84657 7223M
84658 7223M
85081 7170,7171M 0
85084 7192M
85085 7192M
85121 7170,7171M 0
85124 7192M
85125 7192M
85167 7170,7171M 0
85170 7192M
85171 7192M
85213 7170,7171M 0
85216 7192M
85217 7192M
85259 7170,7171M 0
85262 7192M
85263 7192M
85314 7192M
85317 7170,7171M 0
85318 7170,7171M 0
85363 7170,7171M 0
85364 7170,7171M 0
85411 7192M
85414 7170,7171M 0
85415 7170,7171M 0
85462 7192M
85465 7170,7171M 0
85466 7170,7171M 0
85513 7192M
85516 7170,7171M 0
85517 7170,7171M 0
85838 7170,7191M 0
85839 7170,7191M 0
85844 7170,7171M 0
85845 7170,7171M 0
85848 7170,7191M 0
85849 7170,7191M 0
85854 7170,7171M 0
85855 7170,7171M 0
85858 7170,7191M 0
85859 7170,7191M 0
85864 7170,7171M 0
85865 7170,7171M 0
86142 7170,7171M 0
86165 7170,7171M 0
86192 7192M
86215 7192M
86471 7170,7191,7310M 0
86472 7170,7191,7310M 0
86524 7192M
86627 7192M
86658 7170,7171M 0
86696 7192M
86727 7170,7171M 0
86747 7170,7191M 0
86748 7170,7191M 0
86800 7192M
89075 7192M
89077 7170,7171M 0
89816 7170,7191M 0
89868 7170,7191M 0
89940 7170,7191,7310M 0
89997 7170,7191M 0
90004 7170,7191M 0
90885 7192M
90906 7171,7170M 0
90910 7192M
90911 7192M
90920 7191,7170M 0
90964 7192M
90985 7171,7170M 0
90989 7192M
90990 7192M
90999 7191,7170M 0
91506 7191,7170M 0