UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9DVn0Fp5LOP8TFwK33eEJZZdrDfPuk6c/IX6fZIa7wk='
WHERE
key_id = 'dd6c418e5d1bfd6d38b763b2b597916f9c5a0e462445455c345aad833a388f3a'
AND (
token = '9DVn0Fp5LOP8TFwK33eEJZZdrDfPuk6c/IX6fZIa7wk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)