UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4ZoVPD4c6lQB+gSk+hxvxxOQlwOVUvC4vRY58BelZF0='
WHERE
key_id = '025e9f1afe204dd561a2b30eb2e214a4c952ca0ed3c92b6cf332627720816634'
AND (
token = '4ZoVPD4c6lQB+gSk+hxvxxOQlwOVUvC4vRY58BelZF0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)