UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1g8fykcTeHUHQLKhqR+A9zdH5vEhe5+6fnIV0Lf+Q8U='
WHERE
key_id = '96b2ab767543dee26cfad1f17511ff3597d710cd5e50a3cd6afd51c0bbef9ba0'
AND (
token = '1g8fykcTeHUHQLKhqR+A9zdH5vEhe5+6fnIV0Lf+Q8U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)