UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jcA3V34jnZF9BegKm51FpX2kAnLQLlAdh+HBYFDBbH4='
WHERE
key_id = '61f1f8fa9e053adff6d7d8efae06f86457681632d770b415cd9a12bf07695dbc'
AND (
token = 'jcA3V34jnZF9BegKm51FpX2kAnLQLlAdh+HBYFDBbH4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)