UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9Lf8ZdsVC3qscOwzZVvHYa5s3B17B8OnUeJwWQULmvk='
WHERE
key_id = '97057c367aae283f2bfa80d2f7185901a340ced489e50964a4184391b90f5866'
AND (
token = '9Lf8ZdsVC3qscOwzZVvHYa5s3B17B8OnUeJwWQULmvk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)