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