UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HX8lziQOPH8ApuiGpzLtEmHRUC8kVBYPYyxZKGChYX8='
WHERE
key_id = '8b8863784f255a1b3977b2ac61957fa1a589899e806a76eaaa46c90d5cd6a195'
AND (
token = 'HX8lziQOPH8ApuiGpzLtEmHRUC8kVBYPYyxZKGChYX8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)