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