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 (
    101143, 101144, 101145, 101146, 101147, 
    101148, 101149, 101150, 101151, 101152, 
    101153, 101154, 101155, 101156, 101157, 
    101158, 101159, 101160, 101161, 101162, 
    101163, 101164, 101165, 101166, 101167, 
    101168, 101169, 101170, 101171, 101172, 
    101173, 101174, 101175, 101176, 101177, 
    101178, 101179, 101180, 101181, 101182, 
    101183, 101184, 101185, 101186, 101187, 
    101188, 101189, 101190, 101191, 101192, 
    101193, 101194, 101195, 101196, 101197, 
    101198, 101199, 101200, 101201, 101202, 
    101203, 101204, 101205, 101206, 101207, 
    101208, 101209, 101210, 101211, 101212, 
    101213, 101214, 101215, 101216, 101217, 
    101218, 101219, 101220, 101221, 101222, 
    101223, 101224, 101225, 101226, 101227, 
    101228, 101229, 101230, 101231, 101232, 
    101233, 101234, 101235, 101236, 101237, 
    101238
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00243

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "54.77"
    },
    "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 (101143,101144,101145,101146,101147,101148,101149,101150,101151,101152,101153,101154,101155,101156,101157,101158,101159,101160,101161,101162,101163,101164,101165,101166,101167,101168,101169,101170,101171,101172,101173,101174,101175,101176,101177,101178,101179,101180,101181,101182,101183,101184,101185,101186,101187,101188,101189,101190,101191,101192,101193,101194,101195,101196,101197,101198,101199,101200,101201,101202,101203,101204,101205,101206,101207,101208,101209,101210,101211,101212,101213,101214,101215,101216,101217,101218,101219,101220,101221,101222,101223,101224,101225,101226,101227,101228,101229,101230,101231,101232,101233,101234,101235,101236,101237,101238))"
          }
        },
        {
          "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": "53.09",
              "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')))"
          }
        },
        {
          "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": 4,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "1.20",
              "eval_cost": "0.48",
              "prefix_cost": "54.77",
              "data_read_per_join": "76"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "position"
            ]
          }
        }
      ]
    }
  }
}

Result

product_id category_ids position
101143 7200M
101144 7200M
101145 7200M
101146 7200M
101147 7200M
101148 7200M
101149 7200M
101150 7200M
101151 7200M
101152 7200M
101153 7200M
101154 7200M
101155 7200M
101156 7200M
101157 7200M
101158 7200M
101159 7200M
101160 7200M
101161 7200M
101162 7200M
101163 7200M
101164 7200M
101165 7200M
101166 7200M
101167 7200M
101168 7200M
101169 7200M
101170 7200M
101171 7200M
101172 7200M
101173 7200M
101174 7200M
101175 7200M
101176 7200M
101177 7200M
101178 7200M
101179 7200M
101180 7200M
101181 7200M
101182 7200M
101183 7200M
101184 7200M
101185 7200M
101186 7200M
101187 7200M
101188 7200M
101189 7200M
101190 7200M
101191 7200M
101192 7200M
101193 7200M
101194 7200M
101195 7200M
101196 7200M
101197 7200M
101198 7200M
101199 7200M
101200 7200M
101201 7200M
101202 7200M
101203 7200M
101204 7200M
101205 7200M
101206 7200M
101207 7200M
101208 7200M
101209 7200M
101210 7200M
101211 7200M
101212 7200M
101213 7200M
101214 7200M
101215 7200M
101216 7200M
101217 7200M
101218 7200M
101219 7200M
101220 7200M
101221 7200M
101222 7200M
101223 7200M
101224 7200M
101225 7200M
101226 7200M
101227 7200M
101228 7200M
101229 7200M
101230 7200M
101231 7200M
101232 7200M
101233 7200M
101234 7200M
101235 7200M
101236 7200M
101237 7200M
101238 7200M