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 = 303 
WHERE 
  cscart_products_categories.product_id IN (
    1078, 886, 884, 679, 1100, 603, 601, 887, 
    885, 1121, 1136, 609, 596, 599, 605, 
    1094, 1150, 1093, 1161, 1075, 892, 922, 
    880, 908, 909, 910, 900, 672, 896, 882, 
    902, 926, 895, 936, 598, 934, 937, 894, 
    913, 889, 890, 888, 932, 933, 675, 911, 
    914, 924, 1112, 1133, 920, 918
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00199

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "121.33"
    },
    "grouping_operation": {
      "using_temporary_table": true,
      "using_filesort": true,
      "cost_info": {
        "sort_cost": "6.20"
      },
      "nested_loop": [
        {
          "table": {
            "table_name": "cscart_categories",
            "access_type": "ALL",
            "possible_keys": [
              "PRIMARY",
              "c_status",
              "p_category_id"
            ],
            "rows_examined_per_scan": 126,
            "rows_produced_per_join": 5,
            "filtered": "4.00",
            "cost_info": {
              "read_cost": "29.72",
              "eval_cost": "1.01",
              "prefix_cost": "30.73",
              "data_read_per_join": "20K"
            },
            "used_columns": [
              "category_id",
              "storefront_id",
              "usergroup_ids",
              "status"
            ],
            "attached_condition": "((`cscart`.`cscart_categories`.`storefront_id` in (0,1)) and ((`cscart`.`cscart_categories`.`usergroup_ids` = '') or find_in_set(0,`cscart`.`cscart_categories`.`usergroup_ids`) or find_in_set(1,`cscart`.`cscart_categories`.`usergroup_ids`)) and (`cscart`.`cscart_categories`.`status` in ('A','H')))"
          }
        },
        {
          "table": {
            "table_name": "cscart_products_categories",
            "access_type": "ref",
            "possible_keys": [
              "PRIMARY",
              "pt"
            ],
            "key": "PRIMARY",
            "used_key_parts": [
              "category_id"
            ],
            "key_length": "3",
            "ref": [
              "cscart.cscart_categories.category_id"
            ],
            "rows_examined_per_scan": 12,
            "rows_produced_per_join": 6,
            "filtered": "10.26",
            "index_condition": "(`cscart`.`cscart_products_categories`.`product_id` in (1078,886,884,679,1100,603,601,887,885,1121,1136,609,596,599,605,1094,1150,1093,1161,1075,892,922,880,908,909,910,900,672,896,882,902,926,895,936,598,934,937,894,913,889,890,888,932,933,675,911,914,924,1112,1133,920,918))",
            "cost_info": {
              "read_cost": "64.86",
              "eval_cost": "1.24",
              "prefix_cost": "107.69",
              "data_read_per_join": "99"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "link_type"
            ]
          }
        },
        {
          "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",
              "cscart.cscart_products_categories.product_id"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 6,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "6.20",
              "eval_cost": "1.24",
              "prefix_cost": "115.13",
              "data_read_per_join": "99"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "position"
            ]
          }
        }
      ]
    }
  }
}

Result

product_id category_ids position
596 303,326,304M 0
598 314,331,303M 0
599 305,303M,329 0
601 305M,303,329 0
603 303,329,305M 0
605 303M,329,305 0
609 304M,303,325 0
672 326,304M,303 0
675 329,303M,305 0
679 315,303M,317 0
880 317M,315,303 0
882 303,318M,315 0
884 303,319M,315 0
885 315,303,319M 0
886 315,303,319M 0
887 315,303,319M 0
888 320M,316,303 0
889 303,321M,316 0
890 303,321M,316 0
892 303,304,322M 0
894 303,304,322M 0
895 303,304,322M 0
896 322M,303,304 0
900 303,304M,322 0
902 303,304,325M 0
908 326M,303,304 0
909 326M,303,304 0
910 326M
911 303,327M,305 0
913 305,303,327M 0
914 327M,305,303 0
918 303,327M,305 0
920 303,327M,305 0
922 303,328M,305 0
924 303,328M,305 0
926 329M,303,305 0
932 305,329M,303 0
933 303,305,329M 0
934 330M,314,303 0
936 330M,314,303 0
937 314,303,332M 0
1075 322M
1078 314M
1093 322M
1094 314M
1100 304M
1112 303M 0
1121 314M
1133 303M 0
1136 314M
1150 314M
1161 304M