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 = 7148 
WHERE 
  cscart_products_categories.product_id IN (
    93890, 93891, 93892, 93893, 94023, 94073, 
    94117, 94119, 94120, 94121, 94122, 
    94123, 94124, 94125, 94126, 94127, 
    94128, 94129, 94130, 94131, 94132, 
    94133, 94134, 94135, 94136, 94137, 
    94138, 94139, 94140, 94141, 94142, 
    94143, 94144, 94145, 94146, 94147, 
    94148, 94149, 94150, 94151, 94152, 
    94153, 94154, 94155, 94156, 94157, 
    94158, 94159, 94160, 94381, 94428, 
    94452, 94453, 94454, 94455, 94456, 
    94457, 94458, 94459, 94460, 94461, 
    94462, 94558, 94559, 94560, 94561, 
    94562, 94563, 94564, 94565, 94566, 
    94567, 94568, 94569, 94570, 94571, 
    94572, 94583, 94584, 94585, 94586, 
    94587, 94588, 94604, 94605, 94606, 
    94607, 94608, 94609, 94610, 94611, 
    94612, 94613, 94614, 94615, 94616
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00906

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "133.77"
    },
    "grouping_operation": {
      "using_temporary_table": true,
      "using_filesort": true,
      "cost_info": {
        "sort_cost": "8.90"
      },
      "nested_loop": [
        {
          "table": {
            "table_name": "cscart_categories",
            "access_type": "ALL",
            "possible_keys": [
              "PRIMARY",
              "c_status",
              "p_category_id"
            ],
            "rows_examined_per_scan": 208,
            "rows_produced_per_join": 8,
            "filtered": "4.00",
            "cost_info": {
              "read_cost": "20.72",
              "eval_cost": "0.83",
              "prefix_cost": "21.55",
              "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": "cscart_products_categories",
            "access_type": "ref",
            "possible_keys": [
              "PRIMARY",
              "link_type",
              "pt"
            ],
            "key": "PRIMARY",
            "used_key_parts": [
              "category_id"
            ],
            "key_length": "3",
            "ref": [
              "nuie_scalesta_net.cscart_categories.category_id"
            ],
            "rows_examined_per_scan": 117,
            "rows_produced_per_join": 8,
            "filtered": "0.91",
            "cost_info": {
              "read_cost": "2.33",
              "eval_cost": "0.89",
              "prefix_cost": "121.75",
              "data_read_per_join": "142"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "link_type"
            ],
            "attached_condition": "(`nuie_scalesta_net`.`cscart_products_categories`.`product_id` in (93890,93891,93892,93893,94023,94073,94117,94119,94120,94121,94122,94123,94124,94125,94126,94127,94128,94129,94130,94131,94132,94133,94134,94135,94136,94137,94138,94139,94140,94141,94142,94143,94144,94145,94146,94147,94148,94149,94150,94151,94152,94153,94154,94155,94156,94157,94158,94159,94160,94381,94428,94452,94453,94454,94455,94456,94457,94458,94459,94460,94461,94462,94558,94559,94560,94561,94562,94563,94564,94565,94566,94567,94568,94569,94570,94571,94572,94583,94584,94585,94586,94587,94588,94604,94605,94606,94607,94608,94609,94610,94611,94612,94613,94614,94615,94616))"
          }
        },
        {
          "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.23",
              "eval_cost": "0.89",
              "prefix_cost": "124.86",
              "data_read_per_join": "142"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "position"
            ]
          }
        }
      ]
    }
  }
}

Result

product_id category_ids position
93890 7208M,7241,7309,7346
93891 7208M,7241,7309,7346
93892 7208M,7241,7309,7346
93893 7208M,7241,7309,7346
94023 7151M,7301
94073 7194M
94117 7167M,7183,7283
94119 7247M,7265
94120 7247M,7265
94121 7247M,7265
94122 7247M,7265
94123 7247M,7265
94124 7247M,7265
94125 7247M,7265
94126 7247M,7265
94127 7247M,7265
94128 7247M,7265
94129 7247M,7265
94130 7247M,7265
94131 7247M,7265
94132 7247M,7265
94133 7247M,7265
94134 7247M,7265
94135 7247M,7265
94136 7247M,7265
94137 7247M,7265
94138 7247M,7265
94139 7247M,7265
94140 7194M
94141 7194M
94142 7194M
94143 7194M
94144 7194M
94145 7194M
94146 7194M
94147 7194M
94148 7194M
94149 7194M
94150 7194M
94151 7194M
94152 7194M
94153 7194M
94154 7194M
94155 7194M
94156 7194M
94157 7194M
94158 7194M
94159 7194M
94160 7194M
94381 7225M,7226
94428 7219M,7313,7338
94452 7157M,7341,7342,7343
94453 7157M,7341,7342,7343
94454 7157M,7341,7342,7343
94455 7157M,7341,7342,7343
94456 7157M,7341,7342,7343
94457 7247M,7265
94458 7157M,7341,7342,7343
94459 7157M,7341,7342,7343
94460 7157M,7341,7342,7343
94461 7157M,7341,7342,7343
94462 7157M,7341,7342,7343
94558 7208M,7241,7309,7346
94559 7208M,7241,7309,7346
94560 7208M,7241,7309,7346
94561 7208M,7241,7309,7346
94562 7208M,7241,7309,7346
94563 7208M,7241,7309,7346
94564 7208M,7241,7309,7346
94565 7208M,7241,7309,7346
94566 7208M,7241,7309,7346
94567 7208M,7241,7309,7346
94568 7208M,7241,7309,7346
94569 7208M,7241,7309,7346
94570 7208M,7241,7309,7346
94571 7208M,7241,7309,7346
94572 7208M,7241,7309,7346
94583 7208M,7241,7309,7346
94584 7208M,7241,7309,7346
94585 7208M,7241,7309,7346
94586 7208M,7241,7309,7346
94587 7208M,7241,7309,7346
94588 7208M,7241,7309,7346
94604 7194M
94605 7194M
94606 7194M
94607 7194M
94608 7194M
94609 7194M
94610 7194M
94611 7194M
94612 7194M
94613 7194M
94614 7194M
94615 7194M
94616 7194M