UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TI2q4It2wLj5ApN87/3d5eZwwotx9d5FHC0WJ7M80hc='
WHERE
key_id = 'ce3995a43a1b415fee26e7b626a1535ed2f734e135feaa17fde08b7509e063b5'
AND (
token = 'TI2q4It2wLj5ApN87/3d5eZwwotx9d5FHC0WJ7M80hc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)