UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0AffPzRMInGoUAwUiJGla1kPenv0SJD144047mwaqpw='
WHERE
key_id = '07fd4431f0bf23893f61ff0079908ca9dc6e473f7ef67d1df3ca459d348cb182'
AND (
token = '0AffPzRMInGoUAwUiJGla1kPenv0SJD144047mwaqpw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)