UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BKhzGKUr4K+jUe54JsUQ08XwKC83pSDx/tHldXscy7Q='
WHERE
key_id = 'a54406790684ae019ffa7cac57e0937f512728eb98b54c05b2985b52aa213939'
AND (
token = 'BKhzGKUr4K+jUe54JsUQ08XwKC83pSDx/tHldXscy7Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)