UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qQ2e0GQpWAL93t0e0C1ajMdwz2mJEu+DzEawGTFKg7w='
WHERE
key_id = '582c2ded7a45ca3bc57b22154b5439cd796ab4eeb1c245a43d55f42d489e3e11'
AND (
token = 'qQ2e0GQpWAL93t0e0C1ajMdwz2mJEu+DzEawGTFKg7w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)