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 (
    90140, 90155, 82444, 84068, 84076, 87360, 
    82537, 84094, 90139, 90154, 87355, 
    87419, 82523, 90296, 90303, 82538, 
    83944, 84088, 82525, 90203, 90214, 
    87417, 84093, 85972, 90153, 90168, 
    82438, 87418, 90757, 90285, 90293, 
    82522, 90295, 90302, 84056, 84064, 
    82547, 82443, 91482, 82437, 87416, 
    90152, 90167, 85971, 84067, 84075, 
    82532, 84092
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.01508

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "72.29"
    },
    "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": 80,
            "rows_produced_per_join": 80,
            "filtered": "100.00",
            "using_index": true,
            "cost_info": {
              "read_cost": "8.29",
              "eval_cost": "8.00",
              "prefix_cost": "16.29",
              "data_read_per_join": "1K"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "link_type"
            ],
            "attached_condition": "(`nuie_scalesta_net`.`cscart_products_categories`.`product_id` in (90140,90155,82444,84068,84076,87360,82537,84094,90139,90154,87355,87419,82523,90296,90303,82538,83944,84088,82525,90203,90214,87417,84093,85972,90153,90168,82438,87418,90757,90285,90293,82522,90295,90302,84056,84064,82547,82443,91482,82437,87416,90152,90167,85971,84067,84075,82532,84092))"
          }
        },
        {
          "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": 80,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "20.00",
              "eval_cost": "8.00",
              "prefix_cost": "44.29",
              "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": "20.00",
              "eval_cost": "0.40",
              "prefix_cost": "72.29",
              "data_read_per_join": "10K"
            },
            "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
82437 7174M
82438 7174M
82443 7169M
82444 7169M
82522 7165,7168,7177M 0
82523 7177M
82525 7178M
82532 7176M
82537 7176M
82538 7179M
82547 7176M
83944 7319,7193M
84056 7319,7193M
84064 7319,7193M
84067 7319,7193M
84068 7319,7193M
84075 7319,7193M
84076 7319,7193M
84088 7193M,7319
84092 7193M,7319
84093 7319,7193M
84094 7193M,7319
85971 7193M,7319
85972 7193M,7319
87355 7177M
87360 7177M
87416 7174M
87417 7174M
87418 7174M
87419 7174M
90139 7193M,7319
90140 7319,7193M
90152 7319,7193M
90153 7319,7193M
90154 7319,7193M
90155 7319,7193M
90167 7193M,7319
90168 7319,7193M
90203 7319,7193M
90214 7319,7193M
90285 7319,7193M
90293 7319,7193M
90295 7319,7193M
90296 7319,7193M
90302 7319,7193M
90303 7319,7193M
90757 7328M,7165 0
91482 7176M