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 = 7143 
WHERE 
  cscart_products_categories.product_id IN (
    86855, 84265, 89384, 89389, 89300, 89432, 
    89731, 89439, 82381, 89301, 82396, 
    86851, 89440, 82416, 86853, 89431, 
    89299, 84263, 84267, 89349, 89334, 
    83088, 89124, 89128, 89160, 89551, 
    82343, 89350, 89263, 89340, 82450, 
    82451, 86238, 91290, 84264, 91913, 
    91914, 91915, 91916, 91917, 91918, 
    91919, 82332, 86814, 86844, 89101, 
    89336, 89729, 89734, 91286, 82415, 
    86854, 89339, 82355, 90093, 90103, 
    90112, 89438, 82398, 86849, 89730, 
    91293, 89353, 82380, 89333, 89354, 
    82340, 82341, 82346, 86389, 86391, 
    89430, 83115, 83125, 83134, 82449, 
    86823, 89123, 89127, 89159, 89550, 
    89355, 89356, 83087, 89284, 89437, 
    91289, 84262, 84266, 90120, 89157, 
    89548, 90092, 90102, 90111, 89335
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.01936

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "129.67"
    },
    "grouping_operation": {
      "using_temporary_table": true,
      "using_filesort": true,
      "cost_info": {
        "sort_cost": "5.87"
      },
      "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": 5,
            "filtered": "0.60",
            "cost_info": {
              "read_cost": "2.33",
              "eval_cost": "0.59",
              "prefix_cost": "121.75",
              "data_read_per_join": "93"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "link_type"
            ],
            "attached_condition": "(`nuie_scalesta_net`.`cscart_products_categories`.`product_id` in (86855,84265,89384,89389,89300,89432,89731,89439,82381,89301,82396,86851,89440,82416,86853,89431,89299,84263,84267,89349,89334,83088,89124,89128,89160,89551,82343,89350,89263,89340,82450,82451,86238,91290,84264,91913,91914,91915,91916,91917,91918,91919,82332,86814,86844,89101,89336,89729,89734,91286,82415,86854,89339,82355,90093,90103,90112,89438,82398,86849,89730,91293,89353,82380,89333,89354,82340,82341,82346,86389,86391,89430,83115,83125,83134,82449,86823,89123,89127,89159,89550,89355,89356,83087,89284,89437,91289,84262,84266,90120,89157,89548,90092,90102,90111,89335))"
          }
        },
        {
          "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": 5,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "1.47",
              "eval_cost": "0.59",
              "prefix_cost": "123.80",
              "data_read_per_join": "93"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "position"
            ]
          }
        }
      ]
    }
  }
}

Result

product_id category_ids position
82332 7147M
82340 7145M
82341 7145M
82343 7145M
82346 7145M
82355 7326M
82380 7326M
82381 7326M
82396 7145M
82398 7146M
82415 7146M
82416 7146M
82449 7160M,7305
82450 7160M,7305
82451 7160M,7305
83087 7145M
83088 7147M
83115 7147M
83125 7147M
83134 7147M
84262 7146M
84263 7145M
84264 7145M
84265 7147M
84266 7146M
84267 7145M
86238 7302M
86389 7145M
86391 7145M
86814 7147M
86823 7326M
86844 7147M
86849 7145M
86851 7145M
86853 7145M
86854 7146M
86855 7145M
89101 7147M
89123 7145M
89124 7147M
89127 7145M
89128 7147M
89157 7145M
89159 7145M
89160 7147M
89263 7143,7153,7154M,7324,7325 0
89284 7143,7153,7288M 0
89299 7143,7153,7154M,7324,7325 0
89300 7143,7153,7154M,7324,7325 0
89301 7143,7153,7154M,7324,7325 0
89333 7326M
89334 7326M
89335 7326M
89336 7326M
89339 7143,7153,7288M 0
89340 7143,7153,7288M 0
89349 7143,7153,7154M,7324,7325 0
89350 7143,7153,7154M,7324,7325 0
89353 7143,7153,7154M,7324,7325 0
89354 7143,7153,7154M,7324,7325 0
89355 7143,7153,7154M,7324,7325 0
89356 7143,7153,7154M,7324,7325 0
89384 7143,7153,7154M 0
89389 7143,7153,7154M,7324,7325 0
89430 7145M
89431 7147M
89432 7145M
89437 7145M
89438 7146M
89439 7145M
89440 7146M
89548 7145M
89550 7145M
89551 7147M
89729 7145M
89730 7145M
89731 7147M
89734 7145M
90092 7145M
90093 7147M
90102 7145M
90103 7147M
90111 7145M
90112 7147M
90120 7147M
91286 7147M
91289 7145M
91290 7147M
91293 7145M
91913 7146M
91914 7146M
91915 7146M
91916 7146M
91917 7146M
91918 7146M
91919 7146M