UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1onTOEXjwcYF2GFJkd2jerkCnqFbXrKJl8e0kS1amt0='
WHERE
key_id = '729314faf884a164d7c67c20461ee0d48ec543894ed23cd8396b0b8328b6e72d'
AND (
token = '1onTOEXjwcYF2GFJkd2jerkCnqFbXrKJl8e0kS1amt0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)