UPDATE Transactions
SET TimeTaken
    = COALESCE(TO_NUMBER(REGEXP_SUBSTR(NewValue, '^-?\d+$')), 0)
    - COALESCE(TO_NUMBER(OldValue),0)
WHERE ObjectType = 'RT::Ticket' AND Type = 'Set' AND Field = 'TimeWorked';