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, 1103, 603, 
    601, 887, 885, 609, 596, 599, 605, 1094, 
    1093, 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, 920, 
    918
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00147

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "117.91"
    },
    "grouping_operation": {
      "using_temporary_table": true,
      "using_filesort": true,
      "cost_info": {
        "sort_cost": "6.28"
      },
      "nested_loop": [
        {
          "table": {
            "table_name": "cscart_categories",
            "access_type": "ALL",
            "possible_keys": [
              "PRIMARY",
              "c_status",
              "p_category_id"
            ],
            "rows_examined_per_scan": 125,
            "rows_produced_per_join": 5,
            "filtered": "4.00",
            "cost_info": {
              "read_cost": "29.49",
              "eval_cost": "1.00",
              "prefix_cost": "30.49",
              "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.47",
            "index_condition": "(`cscart`.`cscart_products_categories`.`product_id` in (1078,886,884,679,1100,1103,603,601,887,885,609,596,599,605,1094,1093,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,920,918))",
            "cost_info": {
              "read_cost": "61.60",
              "eval_cost": "1.26",
              "prefix_cost": "104.09",
              "data_read_per_join": "100"
            },
            "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.28",
              "eval_cost": "1.26",
              "prefix_cost": "111.63",
              "data_read_per_join": "100"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "position"
            ]
          }
        }
      ]
    }
  }
}

Result

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