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 (
    86345, 86349, 86259, 86307, 86297, 86323, 
    86273, 86305, 86377, 86296, 86322, 
    86372, 86375, 86267, 86288, 86340, 
    86341, 86266, 86287, 86302, 86315, 
    86294, 86320, 86295, 86301, 86314, 
    86321, 86264, 86285, 86265, 86286, 
    86293, 86319, 86263, 86284, 95152, 
    95153, 95154, 95155, 95156, 95157, 
    95158, 95165, 95166, 95167, 95168, 
    95169, 95170
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00163

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "48.88"
    },
    "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": 54,
            "rows_produced_per_join": 54,
            "filtered": "100.00",
            "using_index": true,
            "cost_info": {
              "read_cost": "5.68",
              "eval_cost": "5.40",
              "prefix_cost": "11.08",
              "data_read_per_join": "864"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "link_type"
            ],
            "attached_condition": "(`nuie_scalesta_net`.`cscart_products_categories`.`product_id` in (86345,86349,86259,86307,86297,86323,86273,86305,86377,86296,86322,86372,86375,86267,86288,86340,86341,86266,86287,86302,86315,86294,86320,86295,86301,86314,86321,86264,86285,86265,86286,86293,86319,86263,86284,95152,95153,95154,95155,95156,95157,95158,95165,95166,95167,95168,95169,95170))"
          }
        },
        {
          "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": 54,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "13.50",
              "eval_cost": "5.40",
              "prefix_cost": "29.98",
              "data_read_per_join": "864"
            },
            "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": 2,
            "filtered": "5.00",
            "cost_info": {
              "read_cost": "13.50",
              "eval_cost": "0.27",
              "prefix_cost": "48.88",
              "data_read_per_join": "7K"
            },
            "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
86259 7234M
86263 7234M
86264 7231M
86265 7234M
86266 7231M
86267 7234M
86273 7231M
86284 7234M
86285 7231M
86286 7234M
86287 7231M
86288 7234M
86293 7234M
86294 7231M
86295 7234M
86296 7231M
86297 7234M
86301 7234M
86302 7234M
86305 7231M
86307 7234M
86314 7234M
86315 7234M
86319 7234M
86320 7231M
86321 7234M
86322 7231M
86323 7234M
86340 7231M
86341 7231M
86345 7231M
86349 7231M
86372 7228,7230,7236M 0
86375 7228,7230,7236M 0
86377 7228,7230,7236M 0
95152 7231M
95153 7231M
95154 7231M
95155 7231M
95156 7231M
95157 7231M
95158 7231M
95165 7234M
95166 7231M
95167 7231M
95168 7234M
95169 7231M
95170 7231M