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