UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xJfgYht910+WHzndubbT5CQoYDCngkGSYoO3jZSQq3w='
WHERE
key_id = 'e109789754d153b84bf273e9a0e857856bdb2632b09b39bb1e18eb014d5b9851'
AND (
token = 'xJfgYht910+WHzndubbT5CQoYDCngkGSYoO3jZSQq3w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)