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 = 273 
WHERE 
  cscart_products_categories.product_id IN (
    3104, 3107, 6682, 6678, 104, 105, 106, 
    107, 108, 109, 110, 4013, 4014, 4015, 
    4016, 4017, 4018, 4019, 3105, 6677, 
    6686, 64, 118, 224, 225, 285, 3975, 4027, 
    4108, 4109, 4170, 4223, 203, 204, 205, 
    206, 207, 208, 209, 4087, 4088, 4089, 
    4090, 4091, 4092, 4093, 3122, 6675
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00117

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "68.13"
    },
    "grouping_operation": {
      "using_temporary_table": true,
      "using_filesort": true,
      "cost_info": {
        "sort_cost": "7.68"
      },
      "nested_loop": [
        {
          "table": {
            "table_name": "cscart_categories",
            "access_type": "ALL",
            "possible_keys": [
              "PRIMARY",
              "c_status",
              "p_category_id"
            ],
            "rows_examined_per_scan": 40,
            "rows_produced_per_join": 1,
            "filtered": "4.00",
            "cost_info": {
              "read_cost": "4.54",
              "eval_cost": "0.16",
              "prefix_cost": "4.70",
              "data_read_per_join": "6K"
            },
            "used_columns": [
              "category_id",
              "storefront_id",
              "usergroup_ids",
              "status"
            ],
            "attached_condition": "((`gaseus`.`cscart_categories`.`storefront_id` in (0,1)) and ((`gaseus`.`cscart_categories`.`usergroup_ids` = '') or (0 <> find_in_set(0,`gaseus`.`cscart_categories`.`usergroup_ids`)) or (0 <> find_in_set(1,`gaseus`.`cscart_categories`.`usergroup_ids`))) and (`gaseus`.`cscart_categories`.`status` in ('A','H')))"
          }
        },
        {
          "table": {
            "table_name": "cscart_products_categories",
            "access_type": "range",
            "possible_keys": [
              "PRIMARY",
              "pt"
            ],
            "key": "pt",
            "used_key_parts": [
              "product_id"
            ],
            "key_length": "3",
            "rows_examined_per_scan": 48,
            "rows_produced_per_join": 7,
            "filtered": "10.00",
            "index_condition": "(`gaseus`.`cscart_products_categories`.`product_id` in (3104,3107,6682,6678,104,105,106,107,108,109,110,4013,4014,4015,4016,4017,4018,4019,3105,6677,6686,64,118,224,225,285,3975,4027,4108,4109,4170,4223,203,204,205,206,207,208,209,4087,4088,4089,4090,4091,4092,4093,3122,6675))",
            "using_join_buffer": "hash join",
            "cost_info": {
              "read_cost": "46.10",
              "eval_cost": "0.77",
              "prefix_cost": "58.48",
              "data_read_per_join": "122"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "link_type"
            ],
            "attached_condition": "(`gaseus`.`cscart_products_categories`.`category_id` = `gaseus`.`cscart_categories`.`category_id`)"
          }
        },
        {
          "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",
              "gaseus.cscart_products_categories.product_id"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 7,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "1.20",
              "eval_cost": "0.77",
              "prefix_cost": "60.45",
              "data_read_per_join": "122"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "position"
            ]
          }
        }
      ]
    }
  }
}

Result

product_id category_ids position
64 273M 0
104 273M 0
105 273M 0
106 273M 0
107 273M 0
108 273M 0
109 273M 0
110 273M 0
118 273M 0
203 273M 0
204 273M 0
205 273M 0
206 273M 0
207 273M 0
208 273M 0
209 273M 0
224 273M 0
225 273M 0
285 273M 0
3104 273M 0
3105 273M 0
3107 273M 0
3122 273M 0
3975 273M 0
4013 273M 0
4014 273M 0
4015 273M 0
4016 273M 0
4017 273M 0
4018 273M 0
4019 273M 0
4027 273M 0
4087 273M 0
4088 273M 0
4089 273M 0
4090 273M 0
4091 273M 0
4092 273M 0
4093 273M 0
4108 273M 0
4109 273M 0
4170 273M 0
4223 273M 0
6675 273M 0
6677 273M 0
6678 273M 0
6682 273M 0
6686 273M 0