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 (
    315954, 323397, 325134, 14991, 85379, 
    276603, 279485, 301669, 302229, 304271, 
    311272, 311276, 311278, 315849, 315875, 
    315879, 315890, 315907, 315918, 315940, 
    316080, 316422, 323401, 325341, 254793, 
    292592, 299513, 299552, 301767, 312729, 
    315858, 315917, 315937, 315944, 315949, 
    316051, 316079, 316206, 64640, 293151, 
    296861, 305641, 307613, 311268, 311277, 
    314526, 315213, 315900, 315936, 316049, 
    323291, 324558, 324559, 325117, 325288, 
    133629, 265179, 273025, 298721, 306823, 
    307582, 311271, 315901, 315919, 315950, 
    316050, 323287, 323292, 323649, 200976, 
    300745, 311269, 312681, 312769, 315946, 
    323483, 325116, 301456, 307583, 311270
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00366

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 (315954,323397,325134,14991,85379,276603,279485,301669,302229,304271,311272,311276,311278,315849,315875,315879,315890,315907,315918,315940,316080,316422,323401,325341,254793,292592,299513,299552,301767,312729,315858,315917,315937,315944,315949,316051,316079,316206,64640,293151,296861,305641,307613,311268,311277,314526,315213,315900,315936,316049,323291,324558,324559,325117,325288,133629,265179,273025,298721,306823,307582,311271,315901,315919,315950,316050,323287,323292,323649,200976,300745,311269,312681,312769,315946,323483,325116,301456,307583,311270))"
          }
        },
        {
          "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
14991 446M
64640 447M
85379 458M
133629 460M
200976 651M
254793 460M
265179 460M
273025 458M
276603 458M
279485 453M
292592 446M
293151 451M
296861 458M
298721 458M
299513 449M
299552 449M
300745 449M
301456 449M
301669 449M
301767 449M
302229 448M
304271 453M
305641 449M
306823 453M
307582 449M
307583 449M
307613 453M
311268 451M
311269 451M
311270 451M
311271 451M
311272 451M
311276 451M
311277 451M
311278 451M
312681 449M
312729 449M
312769 449M
314526 446M
315213 448M
315849 458M
315858 448M
315875 449M
315879 449M
315890 449M
315900 449M
315901 449M
315907 449M
315917 449M
315918 449M
315919 449M
315936 449M
315937 449M
315940 458M
315944 458M
315946 451M
315949 451M
315950 451M
315954 458M
316049 446M
316050 446M
316051 446M
316079 458M
316080 458M
316206 451M
316422 449M
323287 448M
323291 458M
323292 449M
323397 458M
323401 449M
323483 452M
323649 448M
324558 458M
324559 458M
325116 449M
325117 449M
325134 449M
325288 446M
325341 651M