DELIMITER $$
CREATE TRIGGER `towork` BEFORE UPDATE
ON `modx_lfvideo_items`
FOR EACH ROW
BEGIN
IF (NEW.status <> OLD.status) THEN
CASE NEW.status
WHEN 1 THEN SET NEW.towork = CURRENT_TIMESTAMP();
WHEN 2 THEN SET NEW.finished = CURRENT_TIMESTAMP();
END CASE;
END IF;
END$$
DELIMITER ;