UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'T09eqEqkNW90aB7PaemNlZkoR+g0Db4gN1OdLsnATg0='
WHERE
key_id = '693719eebcc394fee2574d34f2e8fc6a66a1e6eda1affa8b5c34117150009b48'
AND (
token = 'T09eqEqkNW90aB7PaemNlZkoR+g0Db4gN1OdLsnATg0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)