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 = 7144 
WHERE 
  cscart_products_categories.product_id IN (
    101115, 101121, 101122, 101123, 101124, 
    101130, 101131, 101132, 101133, 101514, 
    101515, 101516, 101517, 101523, 101524, 
    101525, 101526, 101532, 101533, 101534, 
    101535, 101552, 101553, 101554, 101555, 
    101561, 101562, 101563, 101564, 101570, 
    101571, 101572, 101573, 101814, 101815, 
    101816, 101817, 101818, 101819, 101820, 
    101821, 101822, 101823, 101824, 101825, 
    101826, 101827, 101828, 101829, 101830, 
    101831, 101832, 101833, 101834, 101835, 
    101836, 101837, 101838, 101839, 101840, 
    101841, 101842, 101843, 101844, 101845, 
    101846, 101847, 101848, 101849, 101850, 
    101851, 101852, 101853
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.01648

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "65.99"
    },
    "grouping_operation": {
      "using_filesort": false,
      "nested_loop": [
        {
          "table": {
            "table_name": "cscart_products_categories",
            "access_type": "range",
            "possible_keys": [
              "PRIMARY",
              "link_type",
              "pt"
            ],
            "key": "pt",
            "used_key_parts": [
              "product_id"
            ],
            "key_length": "3",
            "rows_examined_per_scan": 73,
            "rows_produced_per_join": 73,
            "filtered": "100.00",
            "using_index": true,
            "cost_info": {
              "read_cost": "7.59",
              "eval_cost": "7.30",
              "prefix_cost": "14.89",
              "data_read_per_join": "1K"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "link_type"
            ],
            "attached_condition": "(`nuie_scalesta_net`.`cscart_products_categories`.`product_id` in (101115,101121,101122,101123,101124,101130,101131,101132,101133,101514,101515,101516,101517,101523,101524,101525,101526,101532,101533,101534,101535,101552,101553,101554,101555,101561,101562,101563,101564,101570,101571,101572,101573,101814,101815,101816,101817,101818,101819,101820,101821,101822,101823,101824,101825,101826,101827,101828,101829,101830,101831,101832,101833,101834,101835,101836,101837,101838,101839,101840,101841,101842,101843,101844,101845,101846,101847,101848,101849,101850,101851,101852,101853))"
          }
        },
        {
          "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": 73,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "18.25",
              "eval_cost": "7.30",
              "prefix_cost": "40.44",
              "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"
            ],
            "key": "PRIMARY",
            "used_key_parts": [
              "category_id"
            ],
            "key_length": "3",
            "ref": [
              "nuie_scalesta_net.cscart_products_categories.category_id"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 3,
            "filtered": "5.00",
            "cost_info": {
              "read_cost": "18.25",
              "eval_cost": "0.37",
              "prefix_cost": "65.99",
              "data_read_per_join": "9K"
            },
            "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')))"
          }
        }
      ]
    }
  }
}

Result

product_id category_ids position
101115 7145M
101121 7145M
101122 7147M
101123 7146M
101124 7145M
101130 7145M
101131 7147M
101132 7146M
101133 7145M
101514 7145M
101515 7147M
101516 7146M
101517 7145M
101523 7145M
101524 7147M
101525 7146M
101526 7145M
101532 7145M
101533 7147M
101534 7146M
101535 7145M
101552 7145M
101553 7147M
101554 7146M
101555 7145M
101561 7145M
101562 7147M
101563 7146M
101564 7145M
101570 7145M
101571 7147M
101572 7146M
101573 7145M
101814 7146M
101815 7146M
101816 7146M
101817 7146M
101818 7146M
101819 7146M
101820 7146M
101821 7146M
101822 7146M
101823 7146M
101824 7145M
101825 7145M
101826 7145M
101827 7145M
101828 7145M
101829 7145M
101830 7145M
101831 7145M
101832 7145M
101833 7145M
101834 7146M
101835 7146M
101836 7146M
101837 7146M
101838 7146M
101839 7146M
101840 7146M
101841 7146M
101842 7146M
101843 7146M
101844 7145M
101845 7145M
101846 7145M
101847 7145M
101848 7145M
101849 7145M
101850 7145M
101851 7145M
101852 7145M
101853 7145M