UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'inEhVXnXyQhwIUxXHu60IavWD83HG+pIkiqFrr0kBfE='
WHERE
key_id = 'ab9c623bd938bf53cb949f0af980fbb67749c0ef496f1e744692a46ef2a2a77d'
AND (
token = 'inEhVXnXyQhwIUxXHu60IavWD83HG+pIkiqFrr0kBfE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)