UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iO1rcjYDLr7EExrXC0Lw8qODsC8DF7NhhwBQHXYy9M4='
WHERE
key_id = '42ff46c2acae2db7ce89fdd8b8fb557a4c71282a81f0bef1616b19b3bb00d32e'
AND (
token = 'iO1rcjYDLr7EExrXC0Lw8qODsC8DF7NhhwBQHXYy9M4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)