UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'g0tNpK67SlgLeS7OyVIEc4ExY8yqUa8+/Gdz0QqvE2c='
WHERE
key_id = 'd593d53b4d59e67f1943b109f3c0cd82d11d658f89f5482f548db95f85d569e9'
AND (
token = 'g0tNpK67SlgLeS7OyVIEc4ExY8yqUa8+/Gdz0QqvE2c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)