UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8QMdVkJn4G+OLty9y0FQZbUiwmzn/DsBGflJMNYqj8c='
WHERE
key_id = '4a0096a8ccf697d337e1861ede8d39a463a0d7390ada3ccd24d04f70b70ec419'
AND (
token = '8QMdVkJn4G+OLty9y0FQZbUiwmzn/DsBGflJMNYqj8c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)