UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ieus5omf2n85CfGX5yIapk6gpDuD2700XtRe6Tzbf1k='
WHERE
key_id = 'd66325dcb1be51c80113faa43d8ee56fb324042f4dd0c8e08ae275f4167b6344'
AND (
token = 'Ieus5omf2n85CfGX5yIapk6gpDuD2700XtRe6Tzbf1k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)