Q:

Insert or Update if exists not having to use Primary Key

I am trying to update my db table by checking if my product_number column already exists. I know you can use the INSERT OR UPDATE ON DUPLICATE KEY but the column I am trying to use is not a primary key. 
I found the following query on a stack post but I keep getting the error Unrecognized statement type. (near Duplicate) when I try run it using phpMyAdmin. 
DECLARE @numrecords INT
SELECT @numrecords = count(*)
                    FROM users_remark
                    WHERE product_number = '444'
                    IF @numrecords > 0 THEN
                         UPDATE products
                         SET product_name = 'abc',
                             product_description = def,
                             product_detail = '',
                             product_price = '100',
                             product_price_canada = '200'
                             WHERE product_number = '444'
                    ELSE
                        INSERT INTO products (product_number, product_name, product_description, product_price)
                        VALUES (444, abc, def, 100)
                    END IF

Why is this query not working? 
Is there a better way to achieve what I am trying to accomplish? 

A:

I created a procedure for you:
DELIMITER $$

DROP PROCEDURE IF EXISTS insert_or_update $$
CREATE PROCEDURE insert_or_update(pProduct_number INT, pProduct_name VARCHAR(200), pProduct_description VARCHAR(200), pProduct_detail VARCHAR(200), pProduct_price FLOAT(15,2), pProduct_price_canada FLOAT(15,2))
BEGIN

    DECLARE numrecords INT;    
    SELECT count(*) INTO numrecords FROM products WHERE product_number = pProduct_number;
        IF numrecords > 0 THEN
            UPDATE products SET 
                product_name = pProduct_name,
                product_description = pProduct_description,
                product_detail = pProduct_detail,
                product_price = pProduct_price,
                product_price_canada = pProduct_price_canada
            WHERE product_number = pProduct_number;
        ELSE
            INSERT INTO products (product_number, product_name, product_description, product_price)
            VALUES (pProduct_number, pProduct_name, pProduct_description, pProduct_price);
        END IF;

END $$

DELIMITER ;

To call just:
CALL insert_or_update(444, , 'abc', 'def', '', '100', '444');

