So here's my problem:

I have an article submission form with an optional image upload field.

The submission uses three steps:

1: Transaction starts
2: $_POST array is processed, new row added - id generated by UUID()
3: $_FILES array is processed, image file resized and saved with the name of the inserted row and the appropriate image extension. If this fails - then the transaction is rolled back, and the function returns false.
4: The original row is updated with the name of the image. If this fails, the transaction is rolled back.

I've designated a composite UNIQUE key ('blog_title','post_url')

However, I'm getting a DUPLICATE exception on the new ID generated in step 1.
Is this an inappropriate use of transactions?