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 = 7165 
WHERE 
  cscart_products_categories.product_id IN (
    82488, 91886, 91887, 92329, 92330, 92331, 
    92332, 91479, 92000, 91538, 91539, 
    90210, 90233, 91536, 91537, 90190, 
    92346, 91901, 91902, 91903, 92345, 
    92347, 92348, 90182, 90172, 85638, 
    82551, 90276, 85637, 85636, 90204, 
    90215, 85635, 90209, 90232, 85583, 
    92342, 90196, 91897, 91898, 91899, 
    92341, 92343, 92344, 88925, 88926, 
    88927, 91470
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.01676

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "82.19"
    },
    "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": 91,
            "rows_produced_per_join": 91,
            "filtered": "100.00",
            "using_index": true,
            "cost_info": {
              "read_cost": "9.39",
              "eval_cost": "9.10",
              "prefix_cost": "18.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 (82488,91886,91887,92329,92330,92331,92332,91479,92000,91538,91539,90210,90233,91536,91537,90190,92346,91901,91902,91903,92345,92347,92348,90182,90172,85638,82551,90276,85637,85636,90204,90215,85635,90209,90232,85583,92342,90196,91897,91898,91899,92341,92343,92344,88925,88926,88927,91470))"
          }
        },
        {
          "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": 91,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "22.75",
              "eval_cost": "9.10",
              "prefix_cost": "50.34",
              "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": "22.75",
              "eval_cost": "0.46",
              "prefix_cost": "82.19",
              "data_read_per_join": "11K"
            },
            "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
82488 7173M
82551 7226,7225M
85583 7182,7300,7149M
85635 7173M
85636 7173M
85637 7173M
85638 7173M
88925 7226,7225M
88926 7225M,7226
88927 7226,7225M
90172 7193M,7319
90182 7193M,7319
90190 7319,7193M
90196 7319,7193M
90204 7319,7193M
90209 7319,7193M
90210 7193M,7319
90215 7193M,7319
90232 7193M,7319
90233 7193M,7319
90276 7319,7193M
91470 7225M,7226
91479 7173M
91536 7319,7193M
91537 7319,7193M
91538 7319,7193M
91539 7319,7193M
91886 7225M,7226
91887 7225M,7226
91897 7225M,7226
91898 7225M,7226
91899 7225M,7226
91901 7226,7225M
91902 7226,7225M
91903 7226,7225M
92000 7226,7225M
92329 7226,7225M
92330 7225M,7226
92331 7226,7225M
92332 7226,7225M
92341 7226,7225M
92342 7226,7225M
92343 7226,7225M
92344 7226,7225M
92345 7226,7225M
92346 7226,7225M
92347 7226,7225M
92348 7226,7225M