UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'w636jZM+khOCZI/pmTlMj9toWz21gZFWeliu2LIWANU='
WHERE
key_id = 'd4142ee8dfcd42df5884382ae861ba76396c860e4c57609dd936165532f3dc41'
AND (
token = 'w636jZM+khOCZI/pmTlMj9toWz21gZFWeliu2LIWANU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)