Okay, I did the following from pgsql:
SELECT *
FROM post_custom_fields
WHERE name = 'polls'
AND value LIKE '%399fc6670871474cd7ce0458401fd299%';
It displayed me one row. So, I removed it:
DELETE FROM post_custom_fields
WHERE name = 'polls'
AND value LIKE '%399fc6670871474cd7ce0458401fd299%';
Note: The proper way would be to remove by row id, but since it returned just a single row I did just that. 
After that I re-started upgrade and it completed successfully. Thanks to everyone who posted their hints! 