UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KzoMqWEQN3am02yc7KL0vh+mNBpDCAUO7+SNfTRSF40='
WHERE
key_id = 'd78000896bee5b24471b4eefff2617948643d1116b865f2ffa0ac644f1f4f94f'
AND (
token = 'KzoMqWEQN3am02yc7KL0vh+mNBpDCAUO7+SNfTRSF40='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)