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 = 257 
WHERE 
  cscart_products_categories.product_id IN (
    593, 595, 643, 644, 646, 692, 286, 287, 
    501, 289, 288, 291, 313, 588, 483, 484, 
    293, 310, 294, 295, 296, 298, 299, 300, 
    577, 475, 301, 302, 314, 498, 499, 304, 
    306, 316, 307, 311, 514, 515, 516, 427, 
    319, 320, 531, 322, 325, 326, 410, 327, 
    323, 324
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00080

JSON explain

{
  "query_block": {
    "select_id": 1,
    "read_sorted_file": {
      "filesort": {
        "sort_key": "cscart_products_categories.product_id",
        "table": {
          "table_name": "cscart_products_categories",
          "access_type": "ALL",
          "possible_keys": ["PRIMARY", "pt"],
          "rows": 474,
          "filtered": 21.94092751,
          "attached_condition": "cscart_products_categories.product_id in (593,595,643,644,646,692,286,287,501,289,288,291,313,588,483,484,293,310,294,295,296,298,299,300,577,475,301,302,314,498,499,304,306,316,307,311,514,515,516,427,319,320,531,322,325,326,410,327,323,324)"
        }
      }
    },
    "table": {
      "table_name": "cscart_categories",
      "access_type": "eq_ref",
      "possible_keys": ["PRIMARY", "c_status", "p_category_id"],
      "key": "PRIMARY",
      "key_length": "3",
      "used_key_parts": ["category_id"],
      "ref": ["markins_test.cscart_products_categories.category_id"],
      "rows": 1,
      "filtered": 100,
      "attached_condition": "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')"
    },
    "table": {
      "table_name": "product_position_source",
      "access_type": "eq_ref",
      "possible_keys": ["PRIMARY", "pt"],
      "key": "PRIMARY",
      "key_length": "6",
      "used_key_parts": ["category_id", "product_id"],
      "ref": ["const", "markins_test.cscart_products_categories.product_id"],
      "rows": 1,
      "filtered": 100
    }
  }
}

Result

product_id category_ids position
286 263M,257 50
287 257,263M 60
288 257,263M 100
289 257,263M 70
291 263M,257 120
293 263M,257 150
294 257,263M 170
295 263,257M 180
296 263M,257 190
298 263M,257 210
299 257,263M 220
300 257,263M 230
301 263M,257 250
302 263,257M 260
304 257,263M 280
306 263M,257 290
307 257M,263 300
310 264M,257 151
311 264,257M 440
313 264M,257 121
314 257,264M 261
316 264M,257 291
319 257,265M 510
320 257,265M 520
322 257,265M 540
323 257,265M 590
324 257M,265 591
325 257,265M 550
326 265M,257 560
327 265M,257 580
410 257M,265 570
427 265,257M 500
475 257,264M 241
483 263M,257 135
484 264M,257 136
498 263M,257 271
499 257,264M 272
501 257,263M 65
514 257,263M 491
515 257,264M 492
516 264M,257 493
531 257,265M 530
577 257,263M 240
588 257M,264 123
593 257,264M 0
595 257,264M 0
643 257,265M 0
644 257,264M 0
646 263M,257 0
692 257M,265 0