UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8OdW0M1hVUMuGKxLA2kyG4+lKqghy2YlgK5eXYMnLK0='
WHERE
key_id = 'f8954bdd6c11460eaffcf6ccff60500c510a90fd0fbb9dec1174c6b45ab1c0a7'
AND (
token = '8OdW0M1hVUMuGKxLA2kyG4+lKqghy2YlgK5eXYMnLK0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)