UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'm84YjNUaLJuI2Stnpriot9WJzZo4bRHgZKg2ewqNpe8=' 
WHERE 
  key_id = '8766dc7e642d1ef54ff61e36f8ba2536afecf4788ce82380ec021e668dbf9865' 
  AND (
    token = 'm84YjNUaLJuI2Stnpriot9WJzZo4bRHgZKg2ewqNpe8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027