INSERT INTO counter (`id`, `page_id`, `type`, `user_ip`, `long_ip`, `count`)
VALUES (NULL, :page_id, :type, :user_ip, :long_ip, 1)
ON DUPLICATE KEY UPDATE count = IF(page_id == VALUES(:page_id), VALUES(`count`), `count` + 1
INSERT INTO counter (`id`, `page_id`, `type`, `user_ip`, `long_ip`, `count`)
VALUES(NULL, :page_id, :type, :user_ip, :long_ip, 1)
ON DUPLICATE KEY UPDATE `count` = `count` + 1