UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mMnK3gRNNMKnrfN4dYR9k6MlCR7waSgoq3o19eguhB0='
WHERE
key_id = '858d1982ce3c70530c9538c85ea7a939cc680a99d6fba26b28e85e1eb83262c8'
AND (
token = 'mMnK3gRNNMKnrfN4dYR9k6MlCR7waSgoq3o19eguhB0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)