UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KIXreg3BpTSg9IidySMJW1aY5ay+XvXDD/kKyksKzmo='
WHERE
key_id = 'c992b32c7e5cd9cf295810633db6d59e5c6c680c30ab08501674b03dd22b5684'
AND (
token = 'KIXreg3BpTSg9IidySMJW1aY5ay+XvXDD/kKyksKzmo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)