UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CTm2HHzyp+7GrfX+RvOlO0YFV2Wa7iyz367PgQ8k86o='
WHERE
key_id = '5586b2f04a5e73c33ae0fedc38b6927b5c920e60505ec06bff04913a070e9719'
AND (
token = 'CTm2HHzyp+7GrfX+RvOlO0YFV2Wa7iyz367PgQ8k86o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)