Update records that match like regex from another table
Please try, if you could, this approach:

UPDATE 
    ProductCategories, 
    Products
SET 
    ProductCategories.categoryid = CASE LEFT(UCASE(LTRIM(Products.productname)), 2)
                                      WHEN 'AP' THEN 1
                                      WHEN 'TO' THEN 2
                                      WHEN 'WA' THEN 3
                                      ELSE ProductCategories.categoryid
                                   END
    WHERE 
        ProductCategories.product_id = Products.product_id


I assumed that product ID column is named product_id