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 = 7230 
WHERE 
  cscart_products_categories.product_id IN (
    95171, 95172, 95173, 95174, 95175, 95176, 
    95177, 95178, 95179, 95180, 95181, 
    95182, 95183, 95184, 95185, 95186, 
    95187, 95188, 95189, 95190, 95191, 
    95192, 95193, 95194, 95195, 95196, 
    95197, 95198, 95199, 95200, 95201, 
    95202, 95203, 95204, 95205, 95206, 
    95207, 95208, 95209, 95210, 95211, 
    95212, 95213, 95214, 95215, 95216, 
    95217, 95218, 95219, 95220, 95221, 
    95222, 95223, 95224, 95225, 95226, 
    95227, 95228, 95229, 95230, 95231, 
    95232, 95233, 95234, 95235, 95236, 
    95237, 95238, 95239, 95240, 95241, 
    95242, 95243, 95244, 95245, 95970, 
    95971, 95972, 95973, 95974, 95975, 
    95976, 96050, 96051, 96052, 96053, 
    96054, 96055, 96056, 96057, 96058, 
    96059, 96060, 96061, 96062, 96063
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.01632

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "86.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": 96,
            "rows_produced_per_join": 96,
            "filtered": "100.00",
            "using_index": true,
            "cost_info": {
              "read_cost": "9.89",
              "eval_cost": "9.60",
              "prefix_cost": "19.49",
              "data_read_per_join": "1K"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "link_type"
            ],
            "attached_condition": "(`nuie_scalesta_net`.`cscart_products_categories`.`product_id` in (95171,95172,95173,95174,95175,95176,95177,95178,95179,95180,95181,95182,95183,95184,95185,95186,95187,95188,95189,95190,95191,95192,95193,95194,95195,95196,95197,95198,95199,95200,95201,95202,95203,95204,95205,95206,95207,95208,95209,95210,95211,95212,95213,95214,95215,95216,95217,95218,95219,95220,95221,95222,95223,95224,95225,95226,95227,95228,95229,95230,95231,95232,95233,95234,95235,95236,95237,95238,95239,95240,95241,95242,95243,95244,95245,95970,95971,95972,95973,95974,95975,95976,96050,96051,96052,96053,96054,96055,96056,96057,96058,96059,96060,96061,96062,96063))"
          }
        },
        {
          "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": 96,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "24.00",
              "eval_cost": "9.60",
              "prefix_cost": "53.09",
              "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": 4,
            "filtered": "5.00",
            "cost_info": {
              "read_cost": "24.00",
              "eval_cost": "0.48",
              "prefix_cost": "86.69",
              "data_read_per_join": "12K"
            },
            "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
95171 7234M
95172 7231M
95173 7234M
95174 7231M
95175 7231M
95176 7231M
95177 7234M
95178 7231M
95179 7234M
95180 7231M
95181 7234M
95182 7231M
95183 7231M
95184 7231M
95185 7231M
95186 7231M
95187 7234M
95188 7231M
95189 7234M
95190 7231M
95191 7231M
95192 7231M
95193 7231M
95194 7231M
95195 7234M
95196 7231M
95197 7234M
95198 7231M
95199 7231M
95200 7231M
95201 7234M
95202 7231M
95203 7234M
95204 7231M
95205 7234M
95206 7231M
95207 7231M
95208 7231M
95209 7231M
95210 7231M
95211 7231M
95212 7231M
95213 7234M
95214 7231M
95215 7234M
95216 7231M
95217 7231M
95218 7231M
95219 7234M
95220 7231M
95221 7231M
95222 7234M
95223 7231M
95224 7234M
95225 7231M
95226 7231M
95227 7234M
95228 7231M
95229 7231M
95230 7234M
95231 7231M
95232 7234M
95233 7231M
95234 7234M
95235 7231M
95236 7234M
95237 7231M
95238 7234M
95239 7231M
95240 7234M
95241 7231M
95242 7234M
95243 7231M
95244 7234M
95245 7231M
95970 7231M
95971 7231M
95972 7231M
95973 7231M
95974 7231M
95975 7231M
95976 7231M
96050 7234M
96051 7231M
96052 7234M
96053 7231M
96054 7234M
96055 7231M
96056 7234M
96057 7231M
96058 7234M
96059 7231M
96060 7234M
96061 7231M
96062 7231M
96063 7234M