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 = 7191 
WHERE 
  cscart_products_categories.product_id IN (
    89844, 89845, 89916, 89917, 91483, 91484, 
    85283, 85284, 85380, 85381, 85431, 
    85432, 85482, 85483, 82712, 83301, 
    84496, 84562, 89749, 85281, 85378, 
    85429, 85480, 86466, 86742, 90013, 
    82713, 83302, 85278, 85279, 89750, 
    85282, 85379, 85430, 85481, 85276, 
    82583, 83018, 83019, 83570, 83572, 
    84515, 84581, 85050, 85136, 85182, 
    85228, 90852, 90854, 90931, 90933, 
    91092, 91093, 91178, 91179, 91233, 
    91234, 83016, 83567, 90849, 90928, 
    89742, 89743, 85277, 85048, 85049, 
    85134, 85135, 85180, 85181, 85226, 
    85227, 85044, 83017, 83568, 90850, 
    90929, 91069, 86463, 86464, 86739, 
    86740, 89740, 89741, 86605, 86606, 
    86674, 86675, 83458, 85042, 85043, 
    86603, 86672, 85280, 85377, 85428
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.02579

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "133.19"
    },
    "grouping_operation": {
      "using_temporary_table": true,
      "using_filesort": true,
      "cost_info": {
        "sort_cost": "8.48"
      },
      "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": 8,
            "filtered": "0.87",
            "cost_info": {
              "read_cost": "2.33",
              "eval_cost": "0.85",
              "prefix_cost": "121.75",
              "data_read_per_join": "135"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "link_type"
            ],
            "attached_condition": "(`nuie_scalesta_net`.`cscart_products_categories`.`product_id` in (89844,89845,89916,89917,91483,91484,85283,85284,85380,85381,85431,85432,85482,85483,82712,83301,84496,84562,89749,85281,85378,85429,85480,86466,86742,90013,82713,83302,85278,85279,89750,85282,85379,85430,85481,85276,82583,83018,83019,83570,83572,84515,84581,85050,85136,85182,85228,90852,90854,90931,90933,91092,91093,91178,91179,91233,91234,83016,83567,90849,90928,89742,89743,85277,85048,85049,85134,85135,85180,85181,85226,85227,85044,83017,83568,90850,90929,91069,86463,86464,86739,86740,89740,89741,86605,86606,86674,86675,83458,85042,85043,86603,86672,85280,85377,85428))"
          }
        },
        {
          "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": 8,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "2.12",
              "eval_cost": "0.85",
              "prefix_cost": "124.72",
              "data_read_per_join": "135"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "position"
            ]
          }
        }
      ]
    }
  }
}

Result

product_id category_ids position
82583 7170,7191M 0
82712 7170,7191M 0
82713 7170,7191M 0
83016 7170,7191M 0
83017 7170,7191M 0
83018 7170,7191M 0
83019 7170,7191M 0
83301 7170,7191M 0
83302 7170,7191M 0
83458 7170,7191M 0
83567 7170,7191M 0
83568 7170,7191M 0
83570 7170,7191M 0
83572 7170,7191M 0
84496 7170,7191M 0
84515 7170,7191M 0
84562 7170,7191M 0
84581 7170,7191M 0
85042 7170,7191,7310M 0
85043 7170,7191,7310M 0
85044 7170,7191,7310M 0
85048 7170,7191,7310M 0
85049 7170,7191,7310M 0
85050 7170,7191,7310M 0
85134 7170,7191,7310M 0
85135 7170,7191,7310M 0
85136 7170,7191,7310M 0
85180 7170,7191,7310M 0
85181 7170,7191,7310M 0
85182 7170,7191,7310M 0
85226 7170,7191,7310M 0
85227 7170,7191,7310M 0
85228 7170,7191,7310M 0
85276 7170,7191M 0
85277 7170,7191M 0
85278 7170,7191M 0
85279 7170,7191M 0
85280 7170,7191M 0
85281 7170,7191M 0
85282 7170,7191M 0
85283 7170,7191M 0
85284 7170,7191M 0
85377 7170,7191M 0
85378 7170,7191M 0
85379 7170,7191M 0
85380 7170,7191M 0
85381 7170,7191M 0
85428 7170,7191M 0
85429 7170,7191M 0
85430 7170,7191M 0
85431 7170,7191M 0
85432 7170,7191M 0
85480 7170,7191M 0
85481 7170,7191M 0
85482 7170,7191M 0
85483 7170,7191M 0
86463 7170,7191,7310M 0
86464 7170,7191,7310M 0
86466 7170,7191,7310M 0
86603 7170,7191,7310M 0
86605 7170,7191,7310M 0
86606 7170,7191,7310M 0
86672 7170,7191,7310M 0
86674 7170,7191,7310M 0
86675 7170,7191,7310M 0
86739 7170,7191M 0
86740 7170,7191M 0
86742 7170,7191M 0
89740 7170,7191M 0
89741 7170,7191M 0
89742 7170,7191M 0
89743 7170,7191M 0
89749 7170,7191M 0
89750 7170,7191M 0
89844 7170,7191M 0
89845 7170,7191M 0
89916 7170,7191,7310M 0
89917 7170,7191,7310M 0
90013 7170,7191M 0
90849 7170M,7191 0
90850 7170M,7191 0
90852 7170M,7191 0
90854 7170M,7191 0
90928 7170M,7191 0
90929 7170M,7191 0
90931 7170M,7191 0
90933 7170M,7191 0
91069 7170M,7191 0
91092 7170M,7191 0
91093 7170M,7191 0
91178 7170M,7191 0
91179 7170M,7191 0
91233 7170M,7191 0
91234 7170M,7191 0
91483 7170M,7191 0
91484 7170M,7191 0