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 = 445 
WHERE 
  cscart_products_categories.product_id IN (
    315850, 315943, 316618, 323594, 323621, 
    324557, 73605, 87023, 265180, 300746, 
    305637, 312771, 323588, 324430, 325131, 
    325407, 228357, 261812, 293942, 301454, 
    311274, 312663, 323303, 323592, 323617, 
    323627, 325112, 325133, 265183, 286299, 
    292637, 305636, 323586, 323587, 326296, 
    327385, 328466, 302560, 305634, 305635, 
    311273, 312778, 312795, 312812, 315904, 
    323590, 323591, 323593, 323868, 325122, 
    325132, 325561, 227930, 300730, 305638, 
    323589, 325842, 328159, 300747, 312765, 
    312793, 312794, 315903, 325109, 330705, 
    306671, 312633, 324549, 185419, 269163, 
    273172, 299568, 300753, 302068, 312659, 
    325126, 327998, 328311, 185033, 229515
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00306

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "84.37"
    },
    "grouping_operation": {
      "using_filesort": false,
      "nested_loop": [
        {
          "table": {
            "table_name": "cscart_products_categories",
            "access_type": "range",
            "possible_keys": [
              "PRIMARY",
              "link_type",
              "pt",
              "position",
              "category_position"
            ],
            "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": "(`unicomps`.`cscart_products_categories`.`product_id` in (315850,315943,316618,323594,323621,324557,73605,87023,265180,300746,305637,312771,323588,324430,325131,325407,228357,261812,293942,301454,311274,312663,323303,323592,323617,323627,325112,325133,265183,286299,292637,305636,323586,323587,326296,327385,328466,302560,305634,305635,311273,312778,312795,312812,315904,323590,323591,323593,323868,325122,325132,325561,227930,300730,305638,323589,325842,328159,300747,312765,312793,312794,315903,325109,330705,306671,312633,324549,185419,269163,273172,299568,300753,302068,312659,325126,327998,328311,185033,229515))"
          }
        },
        {
          "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",
              "unicomps.cscart_products_categories.product_id"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 80,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "32.08",
              "eval_cost": "8.00",
              "prefix_cost": "56.37",
              "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",
              "storefront_id"
            ],
            "key": "PRIMARY",
            "used_key_parts": [
              "category_id"
            ],
            "key_length": "3",
            "ref": [
              "unicomps.cscart_products_categories.category_id"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 15,
            "filtered": "19.97",
            "cost_info": {
              "read_cost": "20.00",
              "eval_cost": "1.60",
              "prefix_cost": "84.37",
              "data_read_per_join": "65K"
            },
            "used_columns": [
              "category_id",
              "storefront_id",
              "usergroup_ids",
              "status"
            ],
            "attached_condition": "((`unicomps`.`cscart_categories`.`storefront_id` in (0,1)) and ((`unicomps`.`cscart_categories`.`usergroup_ids` = '') or (0 <> find_in_set(0,`unicomps`.`cscart_categories`.`usergroup_ids`)) or (0 <> find_in_set(1,`unicomps`.`cscart_categories`.`usergroup_ids`))) and (`unicomps`.`cscart_categories`.`status` in ('A','H')))"
          }
        }
      ]
    }
  }
}

Result

product_id category_ids position
73605 453M
87023 446M
185033 446M
185419 448M
227930 461M
228357 453M
229515 460M
261812 461M
265180 460M
265183 449M
269163 460M
273172 447M
286299 460M
292637 448M
293942 458M
299568 449M
300730 449M
300746 449M
300747 449M
300753 449M
301454 449M
302068 448M
302560 461M
305634 449M
305635 449M
305636 449M
305637 449M
305638 449M
306671 458M
311273 451M
311274 451M
312633 449M
312659 449M
312663 449M
312765 449M
312771 449M
312778 449M
312793 449M
312794 449M
312795 449M
312812 458M
315850 458M
315903 449M
315904 449M
315943 452M
316618 449M
323303 451M
323586 451M
323587 451M
323588 451M
323589 451M
323590 451M
323591 451M
323592 451M
323593 451M
323594 451M
323617 448M
323621 448M
323627 448M
323868 448M
324430 651M
324549 446M
324557 458M
325109 449M
325112 449M
325122 449M
325126 449M
325131 449M
325132 449M
325133 449M
325407 452M
325561 479M
325842 458M
326296 446M
327385 451M
327998 454M
328159 447M
328311 449M
328466 454M
330705 448M